src/Controller/AppController.php line 14

  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. #[Route('/')]
  8. class AppController extends AbstractController
  9. {
  10.     #[Route('/'name'index'methods: ['GET'])]
  11.     public function index(): Response
  12.     {
  13.          if ($this->getUser()) {
  14.              return $this->redirectToRoute('dashboard');
  15.          }
  16.     
  17.         return $this->redirectToRoute('app_login');
  18.     }
  19.     
  20.     #[Route('/dashboard'name'dashboard'methods: ['GET'])]
  21.     public function dashboard(): Response
  22.     {
  23.         return $this->render('dashboard/index.html.twig', []);
  24.     }
  25. }