src/Controller/CPanel.php line 21
<?phpnamespace App\Controller;use App\Entity\NavigationItem;use App\Repository\NavigationItemRepository;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\Routing\Annotation\Route;use Symfony\Polyfill\Intl\Icu\Exception\NotImplementedException;class CPanel extends AbstractController {#[Route("/rutas", name:"app_rutas", methods:["POST"])]public function getRoutes(NavigationItemRepository $nirepo){$this->denyAccessUnlessGranted("ROLE_USER");$rutas = $nirepo->createQueryBuilder("ni")->orderBy("ni.prioridad", "asc")->getQuery()->getResult();$rutas = array_filter($rutas, fn(NavigationItem $ni) => $this->isGranted($ni->getMinimumRole()));$rutas = array_map(fn(NavigationItem $ni) => $ni->serialize(), $rutas);return $this->json($rutas);}#[Route("/cPanel/dashboard", name: "cPanel_index")]public function index(){$this->denyAccessUnlessGranted("ROLE_EMPLEADO");return $this->render("cPanel/index.twig");}#[Route("/loginCPanel", name: "cPanel_login")]public function login(){if ($this->getUser()) return $this->redirect($this->generateUrl("cPanel_index"));return $this->render("cPanel/login.twig");}#[Route("logout", name: "logout")]public function logout(){return new NotImplementedException("No es necesario");}}