Answer the question
In order to leave comments, you need to log in
How to update a record in a table if some cells of the data array may be empty?
On the profile settings page, the user can fill in / change several, or maybe just one field. In this case, the $request array may contain empty cells. And the command $user->update($request-all());
will not work or reset the values in some columns. It is clear that you can iterate through the array and throw out empty values, but then you will have to specify all the fields to be filled in the update method.
Is there a toolkit in eloquent that will do everything itself so as not to fence a lot of code?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question