<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/")
*/
class IndexController extends AbstractController
{
/**
* @Route("/{vueRouting}", requirements={"vueRouting"="^(?!api|ws|admin|_(profiler|wdt)).*"}, name="index")
* @return Response
*/
public function indexAction(): Response
{
if ($this->isGranted('ROLE_USER')) {
$data = $this->json([
'id' => $this->getUser()->getId(),
'user_name' => $this->getUser()->getUserName(),
'first_name' => $this->getUser()->getFirstName(),
'last_name' => $this->getUser()->getLastName(),
'email' => $this->getUser()->getEmail(),
]);
return $this->render('base.html.twig', ['data_user' => $data->getContent()]);
}
return $this->render('base.html.twig', []);
}
}