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

makos's avatar

Redirect problem

Hello,

I have problem figuring out how to redirect from non action method. I found solution:

Redirect:back()->send();

this works perfectly, however when I add messages to it:

Redirect:back()->with('success', 'Something finished successfully.')->send();

page is redirected, unfortunately session flash messages are getting lost.

For now I return whole redirect object from protected method to action method, but I would like to fire redirect directly from protected non action method and thus avoid unnecessary object passing.

0 likes
0 replies

Please or to participate in this conversation.