Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dees040's avatar

Laravel forgets session after log out.

I copied this Event Subscriber and when the method onUserLogout() executes I set a session like this:

session(['cart', $event->user->id]);

But when reading the session after the user logged out I get null. Is this normal? My best guess is that Laravel is emptying the sessions on log out? I could be wrong of course. Any ideas?

0 likes
0 replies

Please or to participate in this conversation.