src/Controller/IndexController.php line 13

  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. use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
  7. class IndexController extends AbstractController
  8. {
  9.     #[Route('/'name'app_index')]
  10.     public function index(AuthorizationCheckerInterface $authorizationChecker): Response
  11.     {
  12.         if ($authorizationChecker->isGranted('IS_AUTHENTICATED')) {
  13.             return $this->redirectToRoute('app_dashboard');
  14.         } else {
  15.             return $this->redirectToRoute('app_login');
  16.         }
  17.     }
  18. }