Update without touching timestamps (Laravel)

Jannick Vandaele picture Jannick Vandaele · Sep 19, 2013 · Viewed 49.9k times · Source

Is it possible to update a user without touching the timestamps?

I don't want to disable the timestamps completly..

grtz

Answer

Antonio Carlos Ribeiro picture Antonio Carlos Ribeiro · Sep 20, 2013

Disable it temporarily:

$user = User::find(1);
$user->timestamps = false;
$user->age = 72;
$user->save();

You can optionally re-enable them after saving.

This is a Laravel 4 and 5 only feature and does not apply to Laravel 3.