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

octoxan's avatar

Session not storing if following 5.3 documentation?

In the Laravel 5.3 documentation for sessions - https://laravel.com/docs/5.3/session - it says you can store data in the session by using...

$request->session()->put('keys', $request->all());

...however after changing pages and calling...

$request->session()->get('keys');

it is empty.

It all works properly if I call ->save() after the put. So what I'm wondering is, is ->save() something that always needs called when modifying the session, and if so.. why in the world is it not mentioned anywhere in the documentation?

Was pulling my hair out for a while over this.

0 likes
3 replies
octoxan's avatar

Okay actually calling ->save() doesn't seem to be saving it either.

On one page I have..

$request->session()->put('filters', $request->all());
$request->session()->save();
dd($request->session()->get('filters'));

which always dumps the filters that I just had in $request->all();

but when I go to another page and call

dd($request->session()->get('filters'));

I either get something old/different or null.

octoxan's avatar
octoxan
OP
Best Answer
Level 3

Oh, calling dd() after save() prevents the save().

octoxan's avatar

Nevermind, it's still not saving everything every time. Ugh

Please or to participate in this conversation.