Complete the code to get the current HTTP method from the request.
$method = $request->[1]();In Laravel, method() returns the HTTP method of the request, such as GET or POST.
Complete the code to retrieve an input value named 'email' from the request.
$email = $request->[1]('email');
The input() method fetches input data from the request in Laravel.
Fix the error in the code to check if the request expects a JSON response.
if ($request->[1]()) { // return JSON response }
The correct method to check if the request expects JSON is expectsJson().
Fill both blanks to create a route that handles POST requests and retrieves the 'name' input.
Route::[1]('/submit', function (Request $request) { $name = $request->[2]('name'); return $name; });
Use post to define a POST route and input to get input data from the request.
Fill all three blanks to validate a request input 'age' as required and numeric, then retrieve it.
$validated = $request->validate([
'age' => '[1]|[2]'
]);
$age = $request->[3]('age');Use required and numeric as validation rules, then input to get the value.