I had a very weird issue in Laravel where a specific session value was not persisting after an AJAX request.
To give it some context, I did two AJAX requests, one after the other.
The first AJAX request sets the session value.
The second AJAX request was then not seeing that value.
The issue is a known limitation with sessions in Laravel and the way to fix this is to enable SESSION_BLOCK.
Go into your session.php and if it doesn’t exist, add this:
'block' => env('SESSION_BLOCK', false),
Then, add SESSION_BLOCK=true to your ENV file.