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

sarfaraz1212's avatar

Laravel flash error

I am using flash messages all over my project but for some reason i am getting this error now everthing was working fine.

Method Illuminate\Session\Store::flash does not exist. 

i am making flash messages like this

session()->flash('status', 'Task was successful!');

it was working before now it stopped. i also tired

 Session::flash('success', 'Vehicle Created!');
  Session::put('success', 'Vehicle Created!');

facade with put keyword is working but i don't want to use this. My session settings in env

SESSION_DRIVER=file
SESSION_LIFETIME=120

can someone help me to debug?

0 likes
4 replies
jlrdw's avatar

it was working before now it stopped.

Any changes made, like an upgrade from 10 to 11? Php version?

sarfaraz1212's avatar

@jlrdw no i just made a new model Service.php maybe this is causing issue?

i am using laravel 11 from the start

jlrdw's avatar
jlrdw
Best Answer
Level 75

Are all required use statements included in Service.php? Are you trying to use flash messages with ajax?

sarfaraz1212's avatar

@jlrdw turns out it had something to do with Service.php model when i deleted it, the flash messages are working fine now.

Please or to participate in this conversation.