Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When use PATCH and PUT Method In Laravel? [duplicate]

Tags:

put

patch

laravel

I don't know exact difference between PATCH and PUT method. Can anyone tell me when we should use this methods with proper example.

like image 841
Zobjoys Jeirmov Avatar asked Oct 22 '25 15:10

Zobjoys Jeirmov


1 Answers

Put is when you update the whole model and use patch when you want to update a portion or single attribute. For instance, a user may have a username they change that is stored on the user model. You would patch just the username when they change it. If you would like to replace the whole user model with a new user model you would use a put request.

like image 78
amac Avatar answered Oct 24 '25 06:10

amac



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!