#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:

1$someModel = new SomeModel();
2
3// do something with your model
4
5$someModel->save(['touch' => false]);

Of course setTouchedRelations will work as well:

1$someModel = new SomeModel();
2
3// do what you need
4
5$someModel->setTouchedRelations([]);
6$someModel->save();