<?php
declare(strict_types=1);
namespace App\Controller\Home;
use App\Entity\Security\Administrator;
use App\Entity\Security\Manager;
use App\Entity\Security\ShopManager;
use App\Entity\Security\Support;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
class IndexController extends AbstractController
{
public function index(): Response
{
$user = $this->getUser();
if ($user instanceof Manager) {
return $this->redirectToRoute('foxorders_franchise_dashboard', ['id' => $user->getFranchise()->getId()]);
}
if ($user instanceof ShopManager) {
return $this->redirectToRoute('foxorders_shop_dashboard', ['id' => $user->getShop()->getId()]);
}
if ($user instanceof Administrator || $user instanceof Support) {
return $this->redirectToRoute('foxorders_admin_dashboard');
}
return $this->redirectToRoute('foxorders_dashboard');
}
public function home(): Response
{
return $this->redirectToRoute('foxorders_dashboard');
}
public function Legal_notice(): Response
{
return $this->renderForm('Home/legal_notice.html.twig');
}
}