<?php
namespace App\Http\Controller\Site;
use App\Database\Domain\Entity\Globals;
use App\Database\Domain\Repository\GlobalsRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @Route("/", name="site_index")
*/
class HomeController extends AbstractController
{
public function __invoke(GlobalsRepository $globalsRepository, ?UserInterface $user = null): Response
{
if (null !== $user) {
return $this->redirectToRoute('user_sessions_index');
}
return $this->render('site/index.html.twig',
['tabs_counter' => $globalsRepository->findOneBy(['key' => Globals::TABS_COUNTER])->toInt()]);
}
}