'Laravel update record control
I'm building a laravel application where i have a Reservation model. After the new record is created, the user may want to update it.
I'm looking for a solution to check if the UpdateRequest values are the same of the actual records and if there are updates only update the modified values.
Example, the original record has :
{'id' => 1, 'name' = 'Jhon', surname = 'Doe'}
While the UpdateRequest has
{'id' => 1, 'name' = 'Jhon', surname = 'Kirby'}
So, my questions are :
- How do i check which values are different?
- How do i update only the specified values?
I've tried to look at the documentation of laravel but it doesn't seem to refer to this situation, is there any solution or should I just update all the values?
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
