🎉 initial commit
This commit is contained in:
34
classes/Application/Controller/HomeController.php
Normal file
34
classes/Application/Controller/HomeController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Application\Controller;
|
||||
|
||||
use Application\Generator\Article;
|
||||
use Application\Helper\NumberHash;
|
||||
use Exception;
|
||||
|
||||
class HomeController extends MainController
|
||||
{
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function action(): void
|
||||
{
|
||||
$this->pushToStash('articles', $this->generateArticles());
|
||||
}
|
||||
|
||||
private function generateArticles(): array
|
||||
{
|
||||
$return = [];
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$return[] = (new Article(NumberHash::numHash("home_$i")))->getTeaserData();
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
protected function getTemplate(): string
|
||||
{
|
||||
return '04_templates/t-home/t-home.twig';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user