how can I redirect from my controller to a named route and include variables in the URL, e.g.
return Redirect::to('admin/articles/create/'.$article_type.'/'.$area_id.'/'.$area_type);
this works, but I think that I missed a shortcut or something?
how can I redirect from my controller to a named route and include variables in the URL, e.g.
return Redirect::to('admin/articles/create/'.$article_type.'/'.$area_id.'/'.$area_type);
this works, but I think that I missed a shortcut or something?
In Laravel 5, you can use the helper methods:
return redirect()->route('route.name', [$param]);
You can use Redirect::route()
to redirect to a named route and pass an array of parameters as the second argument
Redirect::route('route.name',array('param1' => $param1,'param2' => $param2))
Hope this helps.
In Laravel 9 you can use the to_route()
helper function.
return to_route('route.name', [$param]);
You can try this :
return redirect()->route('profile', [$user]);
This can help also if you are trying to redirect user to a profile with the id
.