Thursday, January 31, 2019

Laravel redirect route with query string example

No comments
Hi Dear Friends,

In this post We would like to share infinity knowladge My Good experience and Best solution For .

Laravel Examples

We may require to redirect named route with another parameters or query string in laravel application, you can do it simply by using "redirect()" helper. redirect() helper provide method route for redirect named route. In this example i will show you how to redirect simple named route, redirect with named route and params, redirect with named route with message. You can simple use and understand.
So here, let's see how you can redirect route in your controller method:
Redirect to Named Route
public function show()
{
return redirect()->route('home');
}
Redirect to Named Route with parameters
public function show()
{
return redirect()->route('item.view',['id'=>2]);
}
Redirect to Named Route with query string
public function show()
{
return redirect()->route('home')
->with('message','I am back to home page.');
}
As above example you can simple return redirect using route name, you can also do it using url, but i will put article soon for that.
Try this it will help you and for more information click here: Laravel Examples.

Read :

I hope you like this Post, Please feel free to comment below, your Any Idea, suggestion and problems if you face - I am here to Resolve your Any problems.
We hope it can help you...

No comments :

Post a Comment