From 432bba3dee1d9be25b9626ac45115929a6422961 Mon Sep 17 00:00:00 2001 From: Jonathan Tschanter Date: Fri, 21 Jan 2022 15:13:35 +0100 Subject: Add layout based on list entries --- src/Controller/Home.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Controller') diff --git a/src/Controller/Home.php b/src/Controller/Home.php index 7eda5ee..36879e0 100644 --- a/src/Controller/Home.php +++ b/src/Controller/Home.php @@ -30,7 +30,11 @@ class Home public static function dashboard() { - return Template::render('dashboard.twig', []); + $cards = DB::$entityManager->getRepository(Card::class)->findAll(); + $cardOfTheDay = $cards[array_rand($cards)]; + return Template::render('dashboard.twig', [ + 'cardOfTheDay' => $cardOfTheDay, + ]); } } -- cgit v1.2.3