Search code examples
phplaravellaravel-4eloquent

Update without touching timestamps (Laravel)


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

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

grtz


Solution

  • 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.