Fix the flash messages

This commit is contained in:
Dave Smith-Hayes 2024-12-27 03:09:29 +00:00
parent be92fda17b
commit b88d99196d
2 changed files with 4 additions and 3 deletions

View File

@ -49,7 +49,6 @@ class Middlewares
/** @var SessionInterface $session */ /** @var SessionInterface $session */
$session = $container->get(SessionInterface::class); $session = $container->get(SessionInterface::class);
$twig->getEnvironment()->addGlobal('session', $session); $twig->getEnvironment()->addGlobal('session', $session);
$twig->getEnvironment()->addGlobal('flash', $session->getFlash());
$app->add(TwigMiddleware::create($app, $twig)); $app->add(TwigMiddleware::create($app, $twig));

View File

@ -1,5 +1,7 @@
{% for level, message in flash.all() %} {% for level, messages in session.getFlash().all() %}
<div class="flash {{ level }}" role="alert"> <div class="flash {{ level }}" role="alert">
{{ message }} {% for message in messages %}
<div>{{ message }}</div>
{% endfor %}
</div> </div>
{% endfor %} {% endfor %}