Posts Learn Components Snippets Categories Tags About
/

Redirect to Specific Controller Method in Laravel

Learn how to redirect to a specific controller method in Laravel as an alternative to route naming

Created on Aug 17, 2021

22 views

One of the ways to redirect to a resource/method of a controller is to use the "redirect()" method and chain it with the "action()" method. The action method accepts the [email protected] as the 1st parameter and any of the necessary data as the 2nd parameter.
return redirect()->action('[email protected]', ['slug' => $slug]);
By writing it this way, you will be able to directly get the URL to the resource/method by only remembering the controller and method name.

Similar Post

  • Redirect to Named Route in Laravel

Snippets by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your project.

View Components

Other Code Snippets

More