<?php
namespace App\Controller\Front;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/verification-age", name="frontend_age_verification_")
*/
class AgeVerificationController extends AbstractController
{
/**
* @Route("/", name="index", methods={"GET"})
*/
public function index(): Response
{
return $this->render('app/frontend/age_verification.html.twig');
}
/**
* @Route("/ok", name="ok", methods={"GET"})
*/
public function hasAge(Request $request): Response
{
$session = $request->getSession();
$session->set('age_verification', true);
return $this->redirectToRoute('frontend_home');
}
/**
* @Route("/nok", name="nok", methods={"GET"})
*/
public function underAge(): Response
{
return $this->redirect('https://www.google.com/');
}
}