#development #eloquent #laravel #php

When you are using the touches feature in Laravel, you sometimes want to save a model without updating the timestamps of its owners (e.g. when you are running a migration script).

To save a model without touching pass false to save method:

$someModel = new SomeModel();

// do something with your model

$someModel->save(['touch' => false]);

Of course setTouchedRelations will work as well:

$someModel = new SomeModel();

// do what you need

$someModel->setTouchedRelations([]);
$someModel->save();