disply all offerings on homepage

This commit is contained in:
jannisp 2021-04-26 17:31:24 +02:00
parent 8ab7341dc6
commit 0cc7902f7f
6 changed files with 107 additions and 13 deletions

View file

@ -2,24 +2,27 @@
namespace App\Controller;
use App\Repository\OfferingRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Twig\Environment;
class AppController extends AbstractController
{
#[Route('/homepage', name: 'homepage')]
public function index(): Response
#[Route('/', name: 'homepage')]
public function index(Environment $twig, OfferingRepository $offeringRepository): Response
{
return $this->render('app/index.html.twig', [
'controller_name' => 'AppController',
]);
return new Response($twig->render('app/index.html.twig', [
'offerings' => $offeringRepository->findAll(),
]));
}
#[Route('/user', name: 'user_page')]
public function user(): Response
{
return $this->render('app/index.html.twig', [
return $this->render('app/user.html.twig', [
'user' => $this->getUser(),
]);
}