src/Controller/QhubeController.php line 25

  1. <?php
  2. namespace App\Controller;
  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. class QhubeController extends AbstractController
  8. {
  9.     #[Route('/')]
  10.     public function indexNoLocale(Request $request): Response
  11.     {
  12.         // Autodetect language. If you add a language, put it here as well (the order matters if there's no match)
  13.         $locale $request->getPreferredLanguage(['eo''en''fr''br'] );
  14.         return $this->redirectToRoute('home', ['_locale' => $locale]);
  15.     }
  16.     #[Route(
  17.         path'/{_locale}',
  18.         name'home',
  19.     )]
  20.     public function home(): Response
  21.     {
  22.         return $this->render('home.html.twig', []);
  23.     }
  24. //    #[Route(
  25. //        path: '/{_locale}/gifs',
  26. //        name: 'gifs',
  27. ////        requirements: [
  28. ////            '_locale' => 'en|fr|galo',
  29. ////        ],
  30. //    )]
  31. //    public function gifs(): Response
  32. //    {
  33. //        $number = random_int(0, 100);
  34. //
  35. //        return new Response(
  36. //            '<html><body>Lucky number: '.$number.'</body></html>'
  37. //        );
  38. //    }
  39. }