Update Your Model Without Touching the “updated_at” Column

LaravelPosted on

We already published a snippet, that makes the totally opposite, it touches only the updated at the column. But in some cases, we need to update something on our model, but we don’t want to indicate the change in the model’s updated_at timestamp.

Let’s say you have a Post model, where you count the visits to the posts. Of course, when you increase the number of the visit, it’s not the same when you update the title of the post. We want to update the timestamp only when the relevant data has changed.


$post->timestamps = false;


Need a web developer? Maybe we can help, get in touch!

Similar Posts

More content in Laravel category