Level 39
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to get data from the database and put it in session only when a new session is created, can I do that? in another word, I want to make something like an event listener that fires with new session creation.
Isn't simply doing this good enough. May be even in a middleware.
if ( $request->session()->missing('my_key') ) {
$request->session()->put('my_key', 'my_value');
}
Please or to participate in this conversation.