<?php
// src/Controller/AdminController.php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class AdminController extends AbstractController
{
/**
* @Route("/", name="home_page")
* @Route("/admin/agenda", name="admin")
* @Route("/admin/agenda", name="app_agenda")
*/
public function restockAction( \Swift_Mailer $mailer)
{
$this->denyAccessUnlessGranted('ROLE_ADMIN');
// or add an optional message - seen by developers
$this->denyAccessUnlessGranted('ROLE_ADMIN', null, 'User tried to access a page without having ROLE_ADMIN');
// the template path is the relative file path from `templates/`
return $this->render('admin/agenda.html.twig', []);
}
}