Spookie/src/Controller/MainController.php

30 lines
634 B
PHP

<?php
// src/Controller/LuckyController.php
namespace App\Controller;
use App\Repository\QuotesRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
*
*/
class MainController extends AbstractController
{
/**
* @throws \Exception
*/
#[Route(path: '/', name: 'app_main')]
public function quote(QuotesRepository $quotesRepository): Response
{
$quote = $quotesRepository->findOneRandom();
return $this->render(view: 'base.html.twig', parameters: [
'quote' => $quote->getQuote()
]);
}
}