src/Controller/DefaultController.php line 12

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 DefaultController extends AbstractController
  7. {
  8.     #[Route('/'name'app_default')]
  9.     public function index(): Response
  10.     {
  11.        $usuario$this->get('security.token_storage')->getToken()->getUser();
  12.        
  13.         if (in_array('ROLE_EXTERNO'$usuario->getRoles(), true)) {
  14.           return $this->redirectToRoute('app_comun_proyecto_index', [], Response::HTTP_SEE_OTHER);
  15.         }
  16.         return $this->render('default/index.html.twig', [
  17.         ]);
  18.     }
  19. }