src/Controller/Cliente/DashboardController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Cliente;
  3. use App\Repository\Questionario231DestinatarioRepository;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. /**
  7.  * Controller usato come base di smistamento subito dopo il login
  8.  * in case al ruolo, poi, gli carico la giusta dashboard
  9.  *
  10.  * @Route("/")
  11.  */
  12. class DashboardController extends AbstractController
  13. {
  14.     /**
  15.      * @Route("/", name="default_dashboard")
  16.      */
  17.     public function index()
  18.     {
  19.         $isCliente $this->isGranted('ROLE_CLIENTE');
  20.         $isSuperAdmin $this->isGranted('ROLE_SUPER_ADMIN');
  21.         $isAdmin $this->isGranted('ROLE_ADMIN');
  22.         $isLawyer $this->isGranted('ROLE_LAWYER');
  23.         $isSecretary $this->isGranted('ROLE_SECRETARY');
  24.         if($isCliente){
  25.             return $this->redirectToRoute('cliente_dashboard');
  26.         }
  27.         if($isSuperAdmin){
  28.             return $this->redirectToRoute('admin_dashboard');
  29.         }
  30.         if($isAdmin){
  31.             return $this->redirectToRoute('admin_dashboard');
  32.         }
  33.         if($isLawyer){
  34.             return $this->redirectToRoute('admin_dashboard');
  35.         }
  36.         if($isSecretary){
  37.             return $this->redirectToRoute('admin_dashboard');
  38.         }
  39.         return $this->redirectToRoute('security_login');
  40.         //return $this->render('default/dashboard/index.html.twig', []);
  41.     }
  42.     /**
  43.      * @Route("/cliente", name="cliente_dashboard")
  44.      */
  45.     public function clienteDashboard(Questionario231DestinatarioRepository $destinatarioRepository)
  46.     {
  47.         return $this->render('cliente/dashboard/index.html.twig', [
  48.             'destinatari' => $destinatarioRepository->getUserDestinatario($this->getUser()->getId())
  49.         ]);
  50.     }
  51. }