Skip to content

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

In Laravel, you can redirect from a controller to a named route with URL parameters using the redirect() helper function. The route() helper function can be used to generate the URL for the named route, and you can pass any necessary parameters as arguments.

Here's an example:

Example of redirecting from a controller to a named route with URL parameters using the redirect() helper function in Laravel

php
return redirect()->route('routeName', ['param1' => 'value1', 'param2' => 'value2']);

You can also redirect to route with action

Example of redirecting from a controller to a named route with URL parameters using action in Laravel

php
return redirect()->action('ControllerName@methodName', ['param1' => 'value1', 'param2' => 'value2']);

Dual-run preview — compare with live Symfony routes.