src/Controller/Front/AgeVerificationController.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. /**
  8.  * @Route("/verification-age", name="frontend_age_verification_")
  9.  */
  10. class AgeVerificationController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/", name="index", methods={"GET"})
  14.      */
  15.     public function index(): Response
  16.     {
  17.         return $this->render('app/frontend/age_verification.html.twig');
  18.     }
  19.     /**
  20.      * @Route("/ok", name="ok", methods={"GET"})
  21.      */
  22.     public function hasAge(Request $request): Response
  23.     {
  24.         $session $request->getSession();
  25.         $session->set('age_verification'true);
  26.         return $this->redirectToRoute('frontend_home');
  27.     }
  28.     /**
  29.      * @Route("/nok", name="nok", methods={"GET"})
  30.      */
  31.     public function underAge(): Response
  32.     {
  33.         return $this->redirect('https://www.google.com/');
  34.     }
  35. }