Hey,
In order to identify the type of HTTP request we use method() function and then check it by isMethod() function to identify the request.
For example: In controller created in Laravel
class user extend controller
{
public function index(Request $req)
{
echo $req->method();
}
}
The above code will display the type of request. Now in order to execute certain condition based on request do follow the sample example
class user extend controller
{
public function index(Request $req)
{
echo $req->method();
if($req->isMethod('GET'))
echo "Neeraj";
else
echo "edureka";
}
}