Kris Kris - 2 years ago 139
PHP Question

Laravel: redirect from controller to named route with prams in URL

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?

Answer Source

You can use Redirect::route() to redirect to a named route and pass an array of parameters as the second argument

 Redirect::route('',array('param1' => $param1,'param2' => $param2))

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download