From b88d99196ddfb2ded35d91276cdbd17cdb13051a Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Fri, 27 Dec 2024 03:09:29 +0000 Subject: [PATCH] Fix the flash messages --- app/src/Middlewares.php | 1 - app/templates/layouts/components/flash.twig | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/Middlewares.php b/app/src/Middlewares.php index 4499cc6..f11eea0 100644 --- a/app/src/Middlewares.php +++ b/app/src/Middlewares.php @@ -49,7 +49,6 @@ class Middlewares /** @var SessionInterface $session */ $session = $container->get(SessionInterface::class); $twig->getEnvironment()->addGlobal('session', $session); - $twig->getEnvironment()->addGlobal('flash', $session->getFlash()); $app->add(TwigMiddleware::create($app, $twig)); diff --git a/app/templates/layouts/components/flash.twig b/app/templates/layouts/components/flash.twig index b5ea5e6..e09828a 100644 --- a/app/templates/layouts/components/flash.twig +++ b/app/templates/layouts/components/flash.twig @@ -1,5 +1,7 @@ -{% for level, message in flash.all() %} +{% for level, messages in session.getFlash().all() %} {% endfor %}