How to access Laravel Query String?

If you optate to get Query string value then you can get utilizing 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 facilely get parameter value.

URL Example:

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

Route Example:

Route::get('demo', 'DemoController@demo');

Controller Example:

public function demo(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();

About OakML

Hi we are enthusiastic developers team, we try to serve some good idea to open source community

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!