<?php
namespace App\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Service\UserBack\UserBackManager;
/**
* Class HomeController
* @package App\Controller\Back
*/
class HomeController extends AbstractController
{
/** @var UserBackManager */
private $userBackManager;
public function __construct(UserBackManager $userBackManager)
{
$this->userBackManager = $userBackManager;
}
/**
* @Route("/", name="index")
*/
public function index(): Response
{
return $this->redirectToRoute('home',[], 301);
}
/**
* @IsGranted("ROLE_USER", statusCode=403, message="Vous n'avez pas accès à cette fonctionnalité")
* @Route("/dashboard", name="home", options = { "expose" = true })
* @return Response
*/
public function home(): Response
{
return $this->render('home.html.twig', [
'products' => $this->userBackManager->getAvailableProducts(),
]);
}
}