What is the difference between save() and update () method ?
What's the difference between save() and update() and what's the best use case for each of the method. I read the Laravel docs but I feel I need more of a deeper understanding of the two methods.
In theory they are the same. Update calls save under the hood. The difference is that update checks for guarded properties while save does not. And the syntax is different
@atoagustyn it depends on the situation. For instance I often get the data I want to update from validation. Here it makes sense to just pass it to update
$post->update($validated);
But if it is just setting a single column, I would use save
@debiprasad I disagree. Yes they are different methods, but the OP just said difference between update and save. No distinction made between Builder and Model