@ligonsker What is your session driver?
If it is File, can you make sure that it has the right permission?
For example:
chmod -R 775 storage
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I deleted the previous post because I realized it's not just the session helper.
I have a weird problem where sometimes sessions won't be stored, either using the helper or the $request->session()->put(...); method.
For example, I have a simple controller method that returns a view and also stores a session if it doesn't exist yet:
public function my_view(Request $request)
{
if(!$request->session()->has('my_session')) {
$request->session()->put('my_session', 'default_value');
}
.. some code ..
return view('my_view');
}
Then, I am using this session on another method, which is called by clicking on a button on the same view above:
public function some_action(Request $request)
{
$my_session_value = $request->session()->get('my_session'); // null
// need to use $my_session_value but it's null sometimes!
}
But the session value returns null, and after refreshing the view a few times, or clicking the button that updates that session value, it would work.
And it doesn't happen all the time, but it does happen many times after the initial page load
What could cause that?
Please or to participate in this conversation.