Add the Home page

This commit is contained in:
Oliver Davies 2020-12-26 21:45:49 +00:00
parent 559ed8e908
commit cdb0e67eb3
4 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace App\Controller;
use Twig\Environment;
abstract class BaseController
{
protected Environment $twig;
public function __construct(Environment $twig)
{
$this->twig = $twig;
}
}

View file

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
final class HomeController extends BaseController
{
/**
* @Route("/", name="home")
*/
public function __invoke(): Response
{
$content = $this->twig->render('pages/home.html.twig');
return new Response($content);
}
}