Files
herbarium/src/Controller/PostController.php

21 lines
534 B
PHP

<?php
namespace App\Controller;
use App\Repository\PostRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class PostController extends AbstractController
{
#[Route('/', name: 'app_posts')]
public function index(PostRepository $repository): Response
{
$posts = $repository->findAll();
return $this->render('post/index.html.twig', [
'posts' => $posts,
]);
}
}