How to Redirect Route with Querystring in Laravel?
In this post we will give you information about How to Redirect Route with Querystring in Laravel?. Hear we will give you detail about How to Redirect Route with Querystring in Laravel?And how to use it also give you demo for it if it is necessary.
Most of time, we work on back-end and we require to redirect route or url from controller with pass query string parameter. so laravel provide very simple way to pass query string parameter with redirect route. In following example you can see how it is possible.
In Bellow example you can see i did added highchart() function for route haddle. in that function i redirect “home” route with 2 parameter as query string like id and itemid, so url will be like this way:
And controller function will be this way:
Example:
namespace AppHttpControllers;
use IlluminateHttpRequest;
use AppView;
class HomeController extends Controller
{
public function highchart()
{
$viewer = View::all();
return redirect()->route('home',['id'=>2,'itemid'=>3])
->with('info','We are in home back.');
}
}
Hope this code and post will helped you for implement How to Redirect Route with Querystring in Laravel?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs