How to redirect root with queristring in Laravel?

0
53



Most of the time, we work on the back-end and we have to redirect the root or URL from the controller with the pass query string parameter. Therefore Laravels provide a much simpler way to pass query string parameters through a redirected route. In the following example you can see how this is possible.

In the bellow example you can see that I have added the highchart () function for the route huddle. In that function I redirect the “home” route with 2 parameters as a query string like ID and item, so the URL would be like this:

http://test.hd/home?id=2&itemid=3

And the controller function will be as follows:

Examples:

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.');

}


}

.

LEAVE A REPLY

Please enter your comment!
Please enter your name here