Retrieve all the incoming request's input data as an array
$input = $request->all();
Retrieve all the incoming request's input data as a collection
$input = $request->collect();
// retrieve subset as collection
$request->collect('users')->each(function ($user) {
// ...
});
See Helpers Retrieve user input (also gets values from query string)
$name = $request->input('name');
// with default value if none present
$name = $request->input('name', 'Sally');
Access array inputs
$name = $request->input('products.0.name');
$names = $request->input('products.\*.name');
Retrieve all the input values as an associative array:
$input = $request->input();
Only retrieve values from the query string:
$name = $request->query('name');
// with default value
$name = $request->query('name', 'Helen');
Retrieve all the query string values as an associative array:
$query = $request->query();
#Boolean Input Values
Helpful for checkbox inputs or other booleans.
Return true
for 1
, "1"
, true
, "true"
, "on"
, and "yes"
.
All other values will return false
$archived = $request->boolean('archived');
Comments