src/Controller/IndexController.php line 18

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. /**
  7.  * @Route("/")
  8.  */
  9. class IndexController extends AbstractController
  10. {
  11.     /**
  12.      * @Route("/{vueRouting}", requirements={"vueRouting"="^(?!api|ws|admin|_(profiler|wdt)).*"}, name="index")
  13.      * @return Response
  14.      */
  15.     public function indexAction(): Response
  16.     {
  17.         if ($this->isGranted('ROLE_USER')) {
  18.             $data $this->json([
  19.                 'id' => $this->getUser()->getId(),
  20.                 'user_name' => $this->getUser()->getUserName(),
  21.                 'first_name' => $this->getUser()->getFirstName(),
  22.                 'last_name' => $this->getUser()->getLastName(),
  23.                 'email' => $this->getUser()->getEmail(),
  24.             ]);
  25.             return $this->render('base.html.twig', ['data_user' => $data->getContent()]);
  26.         }
  27.         return $this->render('base.html.twig', []);
  28.     }
  29. }