The helper function returns the URL that belongs to the route with that name. So you can pass the result of that function into the redirect function, which expects a URL.
return redirect(route('home'));
As second parameter of the route() function you can fill route parameters if needed.
The redirect() function actually don't return a RedirectResponse, it is returning a Illuminate\Routing\Redirector. This class do have the route() method.
ftiersch said:
The helper function returns the URL that belongs to the route with that name. So you can pass the result of that function into the redirect function, which expects a URL.
return redirect(route('home'));
As second parameter of the route() function you can fill route parameters if needed.
Thanks for your reply.
christoffertyrefors said:
The redirect() function actually don't return a RedirectResponse, it is returning a Illuminate\Routing\Redirector. This class do have the route() method.
Ok, I understand, thanks so much.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community