Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Atoagustyn's avatar

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.

0 likes
9 replies
Sinnbeck's avatar

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

Oh and save works for both create and update.

2 likes
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@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

$post->slug = $slug;
$post->save();
1 like
Snapey's avatar

use update where you already have the data in an array or collection that matches your model

use save when you already have the model in memory and need to update some of the attributes

Don't over look the fact that update can work directly without loading the model first, eg

Post::where('id',$id)->update(['status' => 'published']);
3 likes
Sinnbeck's avatar

@atoagustyn happy to help. If the issue was solved please mark a best answer to set the thread as solved

debiprasad's avatar

Illuminate\Database\Eloquent\Model::update(array $attributes = [], array $options = []) is a shorthand for

$this->fill($attributes)->save($options);

@sinnbeck said

update checks for guarded properties while save does not.

This does not look correct.

@snapey said

Don't over look the fact that update can work directly without loading the model first,

This is not correct. The update method on the Model object is different than the update method on the Illuminate\Database\Eloquent\Builder object.

Snapey's avatar

@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

debiprasad's avatar

@Snapey Yes, OP talks about the difference between Illuminate\Database\Eloquent\Model::save and Illuminate\Database\Eloquent\Builder::update.

I just clarified that both the update methods are different.

Please or to participate in this conversation.