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->visits++; $post->timestamps = false; $post->save();