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

N8dev's avatar
Level 1

Laravel 8 -Flash data no longer saving

I have been working on a Laravel 8 project ( Laravel Framework 8.82.0 now ) for a long time now but within the last 30 days flash data has essentially stopped working across the full project.

Standard session data still works fine with shopping carts and such all working as normal.

I am doing something as simple as:

return redirect()->back()->with('addtocart', $product->name . ' has been added to your shopping cart');

On the next page there is no trace of this flash data at all. I have dumped all of the session data, used the Toolbar and even tried to use session->flash() but nothing sticks.

There has been numerous updates to the website in the last month or two, but nothing related to session/flash data.

Is there something I am missing here? What should I be looking for in the scenario?

My last option would be to revert to session->put(), but there are literally thousands of references to flash data so spending time bug fixing this is my best option right now.

0 likes
6 replies
Nihir's avatar

Hi @yoeunes, I never tried your PHPFlasher package. Sorry for that

But I will try it in my next project seems like it's a fantastic package

1 like
Snapey's avatar

Check your network requests in the browser. Are you being redirected for some reason? The flash will only last the first request and not the redirect.

stackdevelopers's avatar

Flash messages working fine in Laravel 9. We can simply use Session variables as an alternative if sometimes Flash messages are not working. I have used Flash messages like below in one of my Laravel website like below :-

In function :-

$message = "Required Quantity is not available!"; session::flash('error_message',$message); return redirect()->back();

In blade file :- @if(Session::has('error_message')) {{ Session::get('error_message') }} × @endif

Please or to participate in this conversation.