Redirects: Redirecting To Named Routes

Return redirect()->route('login');
// For a route with the following URI: profile/{id}

return redirect()->route('profile', ['id' => 1]);

To generate a RedirectResponse to a named route, you may use the route method.

If your route has parameters, you may pass them as the second argument to the route method.

Populating Parameters Via Eloquent Models

// For a route with the following URI: profile/{id}

return redirect()->route('profile', [$user]);
/**
 * Get the value of the model's route key.
 *
 * @return mixed
 */
public function getRouteKey()
{
    return $this->slug;
}

If you would like to customize the value that is placed in the route parameter, you should override the getRouteKey method on your Eloquent model.

Redirects: Redirecting To Named Routes — Structure map

Clickable & Draggable!

Redirects: Redirecting To Named Routes — Related pages: