src/Controller/DefaultController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. /**
  7.  * Class DefaultController
  8.  * @package App\Controller
  9.  */
  10. class DefaultController extends AbstractController
  11. {
  12.     #[Route('/'name'home')]
  13.     public function index(): Response
  14.     {
  15.         if ($this->isGranted('ROLE_ADMIN') === true) {
  16.             return $this->redirectToRoute('admin.index');
  17.         }
  18.         return $this->render(
  19.             'default/index.html.twig',
  20.             []
  21.         );
  22.     }
  23.     #[Route('form/'name'form_list')]
  24.     public function formList(): Response
  25.     {
  26.         return $this->render(
  27.             'default/form.html.twig',
  28.             []
  29.         );
  30.     }
  31.     #[Route('/phpinfo'name'info'condition"'dev' === '%kernel.environment%'")]
  32.     public function info(): Response
  33.     {
  34.         ob_start();
  35.         phpinfo();
  36.         $phpInfo ob_get_clean();
  37.         return $this->render(
  38.             'default/info.html.twig',
  39.             [
  40.                 "info" => $phpInfo,
  41.             ]
  42.         );
  43.     }
  44. }