Add the session handler as a global twig variable, check for user session details in the skeleton

This commit is contained in:
Dave Smith-Hayes 2024-11-25 20:33:04 -05:00
parent e7aabff62c
commit a1c3bea6e5
4 changed files with 2 additions and 3 deletions

View File

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

View File

@ -19,7 +19,7 @@
<nav>
<ul>
{% if user.authenticated %}
{% if session.get('user').authenticated %}
<li><a href="/dashboard">Dashboard</a></li>
<li><a href="/logout">Logout</a></li>
{% else %}

View File

@ -1,4 +1,3 @@
version: '3.8'
services:
cli:
user: "1000:1000"

View File

@ -1,4 +1,3 @@
version: '3.8'
services:
php:
build: