src/Controller/AdminController.php line 20

Open in your IDE?
  1. <?php
  2. // src/Controller/AdminController.php
  3. namespace App\Controller;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  8. class AdminController extends AbstractController
  9. {
  10.     /**
  11.      * @Route("/", name="home_page")
  12.      * @Route("/admin/agenda", name="admin")
  13.      * @Route("/admin/agenda", name="app_agenda")
  14.      */
  15.     public function restockAction( \Swift_Mailer $mailer)
  16.     {
  17.         $this->denyAccessUnlessGranted('ROLE_ADMIN');
  18.         // or add an optional message - seen by developers
  19.         $this->denyAccessUnlessGranted('ROLE_ADMIN'null'User tried to access a page without having ROLE_ADMIN');
  20.         // the template path is the relative file path from `templates/`
  21.         return $this->render('admin/agenda.html.twig', []);
  22.     }
  23. }