src/Controller/HomeController.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. class HomeController extends AbstractController
  7. {
  8.     /**
  9.      * @Route("/", name="home")
  10.      */
  11.     public function index(): Response
  12.     {
  13.         
  14.        
  15.         if( $this->isGranted('ROLE_ADMIN') || $this->isGranted('ROLE_SALARIE') ) {
  16.             return $this->redirectToRoute("crm.tdb");
  17.         } elseif( $this->isGranted('ROLE_USER') ) 
  18.         {
  19.             return $this->redirectToRoute("dashboard.tdb");
  20.         } elseif( $this->isGranted('ROLE_PRESTA') ) 
  21.         {
  22.             return $this->redirectToRoute("prestataires.tdb");
  23.         } else {
  24.             return $this->redirectToRoute("login");
  25.         }
  26.     }
  27. }