<?php
declare(strict_types=1);
namespace App\Controller\Admin;
use App\Entity\AdminUser;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Umbrella\CoreBundle\Controller\BaseController;
class DefaultController extends BaseController
{
/**
* @Route("/", name="home")
* @Route("/admin", name="admin_home")
*/
public function index(): Response
{
if (in_array($this->getUser()->role, [AdminUser::ROLE_OFFICE])) {
return $this->redirectToRoute('app_admin_serviceuser_index');
}
if (in_array($this->getUser()->role, [AdminUser::ROLE_DEALER, AdminUser::ROLE_ADMIN])) {
return $this->redirectToRoute('app_admin_dealer_index');
}
if ($this->getUser()->role === AdminUser::ROLE_SERVICE) {
return $this->redirectToRoute('app_admin_feedback_index');
}
return $this->render('@UmbrellaAdmin/layout.html.twig');
}
}