How to get Query Strings Value in Laravel 5?

By Hardik Savani | March 29, 2016 | | 15582 Viewer | Category : Laravel


If you want to get Query string value then you can get using Request Facade OR Input Facade in larave 5. But if you was working native PHP then we can get $_GET method. In following example you can easily get parameter value.

URL Example:

http://text.com/wall?id=23&name=hdtopi

In above query string, you want to get query string value for example id and name. you can get through bellow example.

Route Example:

Route::get('wall', 'WallController@wall');

Controller Example:

public function wall(Request $request)

{

/* returns Ony Id value */

$id = $request->input('id');


/* returns array of entire input query value */

$query = $request->all();


/* OR */


/* returns Ony Id value */

$id = Input::get('id');


/* returns array of entire input query value */

$query = Input::all();

}