change homepage route
This commit is contained in:
parent
19d2bfbcc3
commit
d10ef764bc
7 changed files with 80 additions and 64 deletions
|
@ -29,7 +29,7 @@ class DashboardController extends AbstractDashboardController
|
|||
|
||||
public function configureMenuItems(): iterable
|
||||
{
|
||||
yield MenuItem::linktoRoute('Back to the website', 'fas fa-arrow-left', 'homepage');
|
||||
yield MenuItem::linktoRoute('Back to the website', 'fas fa-arrow-left', 'offers');
|
||||
yield MenuItem::linktoDashboard('Dashboard', 'fa fa-home');
|
||||
yield MenuItem::linkToCrud('User', 'fas fa-user', User::class);
|
||||
yield MenuItem::linkToCrud('Offering', 'fas fa-seedling', Offering::class);
|
||||
|
|
|
@ -19,4 +19,10 @@ class AppController extends AbstractController
|
|||
{
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
#[Route('/', name: 'homepage')]
|
||||
public function index(Environment $twig, OfferingRepository $offerRepository): Response
|
||||
{
|
||||
return new Response($twig->render('app/index.html.twig'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class OfferController extends AbstractController
|
|||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
#[Route('/', name: 'homepage')]
|
||||
#[Route('/offers', name: 'offers')]
|
||||
public function index(Environment $twig, OfferingRepository $offerRepository): Response
|
||||
{
|
||||
return new Response($twig->render('app/index.html.twig', [
|
||||
|
@ -62,7 +62,7 @@ class OfferController extends AbstractController
|
|||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash("success", "Successfully added the new offer!");
|
||||
return $this->redirectToRoute('homepage');
|
||||
return $this->redirectToRoute('offers');
|
||||
}
|
||||
|
||||
return $this->render('app/new_offer.html.twig', [
|
||||
|
@ -75,6 +75,7 @@ class OfferController extends AbstractController
|
|||
public function show_offer(Offering $offer, WishRepository $wishRepository): Response
|
||||
{
|
||||
return $this->render('app/offer.html.twig', [
|
||||
'user' => $this->getUser(),
|
||||
'offer' => $offer,
|
||||
'wishes' => $wishRepository->findByUser($offer->getByUser()),
|
||||
]);
|
||||
|
|
Reference in a new issue