laravel 5.2 : Get query string

To determine if an input value is present:

if ($request->has('invitee')) {
       $user->invitee = $request->input('invitee');
}

The has method returns true if the value is present and is not an empty string:


As far as Laravel 5.7 is concerned, the preferred way to retrieve query params is

if( $request->has('invitee') ) {
    $request->query('invitee');
}

or using the helper function if you don't have access to $request

request()->query('invitee');

You can get input by:

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

For above 5.*

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

Or

$invitee = Request::input('invitee');

Tags:

Php

Laravel