Cockpit integration

This commit is contained in:
2024-11-07 21:34:32 +01:00
parent d3eccf99f0
commit a4b336b3fd
8 changed files with 153 additions and 41 deletions

View File

@@ -1,27 +1,33 @@
<?php
declare(strict_types=1);
namespace Application\Controller;
use Application\Generator\Article;
use Application\Helper\NumberHash;
use Application\Content\CockpitApi;
use Exception;
use GuzzleHttp\Exception\GuzzleException;
class HomeController extends MainController
{
/**
* @throws Exception
* @throws GuzzleException
*/
protected function action(): void
{
$this->pushToStash('articles', $this->generateArticles());
$this->pushToStash('articles', $this->getArticles());
}
private function generateArticles(): array
/**
* @throws GuzzleException
*/
private function getArticles(): array
{
$return = [];
for ($i = 0; $i < 10; $i++) {
$return[] = (new Article(NumberHash::numHash("home_$i")))->getTeaserData();
foreach ((new CockpitApi())->getArticles() as $article) {
$return[] = $article->getTeaserData();
}
return $return;