jeudi 21 mars 2019

Laravel session data not persisting

I understand that a request must fully complete for session data to be persisted, but I can't understand why one area of my app isn't doing that (while in others it's working fine).

There's POST request which is routed to a Controller, which (in turn) instantiates a Model and calls a method which runs the following:

session(['currentAttendance' => $id]);

After that completes successfully (which I can see in my debugging console), the controller runs:

return redirect()->route('profile');

But by the time the profile page appears, session('currentAttendance') is returning the previous value again.

Nothing is additionally changing the value, it just appears to not be persisting. There's no premature termination that I can see. No dd() etc.

Why isn't it working?

I've tried to the old session()->save() trick, but that doesn't work the way it used to in Laravel 5.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire