0

I am new to laravel. I made an website to do simple CRUD operation. In my web.php I used route::post() to delete a data. It worked perfectly.

Later I learned that, there is a delete method in laravel. Why should I use delete method when post works perfectly?

Nabil Farhan
  • 1,444
  • 3
  • 25
  • 41
  • 1
    You asked duplicate question look here [https://stackoverflow.com/questions/904001/why-use-http-put-and-delete-methods-instead-of-post](https://stackoverflow.com/questions/904001/why-use-http-put-and-delete-methods-instead-of-post) – sharif854 Nov 05 '18 at 04:52
  • 2
    @sharif854 in the future, please vote to close the question as a duplicate, instead of editing the question, which should be reserved to make needed improvements. – Will B. Nov 05 '18 at 05:12
  • HEAD, DELETE, POST, PUT, OPTIONS, and GET request methods have specific [HTTP 1.1 standards](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html), that correspond to the acceptable responses each should serve. – Will B. Nov 05 '18 at 05:26

1 Answers1

0

Post method is laravel is a simple post request that form does while submitting, but Delete method in laravel specify the type of method being used while posting data, so when you are using Delete method then your form must have Delete input field which specifies the type of action your form is doing on submit with post request. But with simple Post method you don't need any post field it's just a post request with data. for more reference check this https://laravel.com/docs/5.7/routing#route-group-prefixes

Rajender Verma
  • 389
  • 3
  • 9