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

yaddly's avatar

Unable to access session flash method via FormRequest instance

Hi Laracons, I encountered a strange phenomenon when I attempted to flash data to the session using FormRequest instance. According the documentation flash-data, this is as simple as $request->session()->flash('status', 'Task was successful!');. However, this $this->session()->flash('status', 'Task was successful!');, $this being FormRequest instance, does not work and neither does this this?->flash('status', 'Task was successful!'); May I know why that is the case, I resorted to session()->flash() session global function or Session::flash() session facade.

0 likes
1 reply
Snapey's avatar

not the old "does not work" error ?

That MUST be the most common error on this site? What could be behind it I wonder?

Please or to participate in this conversation.