src/Controller/Admin/DefaultController.php line 17

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller\Admin;
  4. use App\Entity\AdminUser;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Umbrella\CoreBundle\Controller\BaseController;
  8. class DefaultController extends BaseController
  9. {
  10.     /**
  11.      * @Route("/", name="home")
  12.      * @Route("/admin", name="admin_home")
  13.      */
  14.     public function index(): Response
  15.     {
  16.         if (in_array($this->getUser()->role, [AdminUser::ROLE_OFFICE])) {
  17.             return $this->redirectToRoute('app_admin_serviceuser_index');
  18.         }
  19.         if (in_array($this->getUser()->role, [AdminUser::ROLE_DEALERAdminUser::ROLE_ADMIN])) {
  20.             return $this->redirectToRoute('app_admin_dealer_index');
  21.         }
  22.         if ($this->getUser()->role === AdminUser::ROLE_SERVICE) {
  23.             return $this->redirectToRoute('app_admin_feedback_index');
  24.         }
  25.         return $this->render('@UmbrellaAdmin/layout.html.twig');
  26.     }
  27. }