This commit is contained in:
jleroy2023
2024-11-20 14:49:09 +01:00
parent 21be9ebb52
commit 5b6b44ab9d
5 changed files with 70 additions and 48 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Controller;
use App\Repository\SortieRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
@@ -10,12 +11,14 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
class MainController extends AbstractController
{
#[Route('/', name: 'home')]
public function index(TokenStorageInterface $tokenStorage): Response
public function index(TokenStorageInterface $tokenStorage, SortieRepository $sortieRepository): Response
{
$token = $tokenStorage->getToken();
$userConnect = $token?->getUser();
$sorties = $sortieRepository->findAll();
return $this->render('main/index.html.twig', [
'profile' => $userConnect,
'sorties' => $sorties,
]);
}
}