disply all offerings on homepage
This commit is contained in:
parent
8ab7341dc6
commit
0cc7902f7f
6 changed files with 107 additions and 13 deletions
|
@ -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(),
|
||||
]);
|
||||
}
|
||||
|
|
Reference in a new issue