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

tristanisginger's avatar

adding a GET variable to a redirect route

In my BlogController after deleting a post I redirect to the index page

return redirect(route('blog.index'))->with('destroyed', 'Kaboom. Your post was destroyed.');

I would like to append ?status=trash to the uri, which I've just realised while writing this I can do using string concatination

return redirect(route('blog.index') . "?status=trash")->with('destroyed', 'Kaboom. Your post was destroyed.');

I'll post this in case somebody else is thick like what I is.

0 likes
1 reply
tisuchi's avatar

What is your question here? @tristanisginger

If you want to know how to pass param after that, I believe this is the easiest way.

redirect('blog.index', ['status' => 'trash']);
1 like

Please or to participate in this conversation.