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

addtobag's avatar

Logout session

When a /logout is actioned it's destroying the sessions, is there a way to prevent this? We're working on a system where users add items to their bag which we are storing in the session. Ideally we want it so that if they logout and log back in it remembers the session.

In use Illuminate\Foundation\Auth\AuthenticatesUsers; $request->session()->invalidate();

0 likes
1 reply
sr57's avatar

When a /logout is actioned it's destroying the sessions

It's the usage of session.

If you want "permanent" storage us db (server side) or cookies (client side).

That said, you can "refill" session data with some data stored in the db (previous session state) ... I had to did this one time.

Please or to participate in this conversation.