I have a named route I want to redirect to, while attaching the request query parameters leaving them in tact. I tried something like the following, which is throwing an exception: preg_match() expects parameter 2 to be string, array given
What's the correct way to do this?
return redirect($request->query())->route('foo.bar', ['name' => env('NAME')]);
This would redirect to the route named foo.bar
with the parameter set in env('NAME')
but also pass along all the query parameters in the original request.
fullUrlWithQuery
might be what you need – nice_dev