In laravel when using Route::resource()
the controller contains 7 methods. I am unsure what the differences are between the edit
and update
methods / resources.
GET /resource/{resource}/edit edit resource.edit
PUT/PATCH /resource/{resource} update resource.update
In my understanding of REST, it seems laravels update
implementation is fairly standard while the edit
route I can't see to think of a scenario to use it when returning resources as JSON.
The difference is that edit
is used to return the HTML form that is used to edit the resource values (notice that it responds to GET
requests), while update
is the "action" that the edit form will be submitting to, and it responds to PUT
or PATCH
requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With