<?php
namespace App\Core\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/", name="app_")
*/
class HomeController extends AbstractController
{
/**
* @Route("{_locale}/", name="home", methods={"GET"})
*
* @param Request $request
* @return Response
*/
public function index(Request $request): Response
{
return $this->render(
'public/home.html.twig',
[
'user' => $this->getUser(),
]
);
}
/**
* @Route("/", name="localeless_home", methods={"GET"})
*
* @param Request $request
* @return Response
*/
public function indexWithoutLocale(Request $request): Response
{
return $this->redirectToRoute('app_home', ['_locale' => $request->getLocale()]);
}
}