How to check request method is GET or POST in Laravel?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in this post i will show you How to check request method is GET or POST in Laravel? Sometimes you need to know the request method is get, post, patch, delete on that way we can take action. If you need take action on depend on the request input method. So we can check this by using request method.

So let’s start and see the bellow example:

Example:
$method = $request->method();
if ($request->isMethod('post')) {
    print('is post method');
}
if ($request->isMethod('get')) {
    print('post method');
}

Read Also: Generate Captcha code and Validation by using BotDetect package in laravel

Thanks for read. I hope it help you. For more you can follow us onĀ facebook.

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →