✨ Cockpit integration
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user