Obvody/app/Presentation/Home/HomePresenter.php

34 lines
721 B
PHP

<?php
declare(strict_types=1);
namespace App\Presentation\Home;
use App\Core\Konstanty;
use App\Model\ObvodFacade;
use Nette;
final class HomePresenter extends Nette\Application\UI\Presenter
{
public function __construct(
private ObvodFacade $obvody,
) {
}
public function beforeRender(): void
{
$this->template->appVersion = Konstanty::verze;
if (!$this->getUser()->isLoggedIn()) {
$this->template->navrat = $this->storeRequest();
}
}
public function renderDefault(): void
{
$this->template->obvody = array_map(
static fn($obvod): int => (int) $obvod->CISLO,
$this->obvody->getObvody(),
);
}
}