Since so many different answers have accumulated here, let me clear up the confusion.
->has(), ->query(), ->input(),...
What do we need to check for a query param and get its value?
The clean minimal solution
$value = $request->query('name');
if ($value) {
// work with the value
}
As stated in Laravel's official documentation section Retrieving Input From the Query String the $request->query('name') is specifically designed to "retrieve values from the query string".
If the method returns null, the param wasn't passed at all or without a value. So with the if condition, we ensure an actual $value.
The all-rounder solution
$request->input() is similar to $request->query(), but it's more general. It does not only work for checking query strings, but also for form data sent via POST, JSON payloads, XHR requests,...
$request->has() checks the sources that the ->input() method draws from.
So this solution works great, too:
if($request->has('name')) {
$value = $request->input('name');
// work with the value
}
It works not only for GET requests with query params, but a lot more.
Regarding the OP's code
You're officially discouraged to use the $request->get() method:
This method belongs to Symfony HttpFoundation and is not usually needed when using Laravel.
Instead, you may use the "input" method.
$_GET['invitee']because this is a query string not part of the Laravel routing.