Reputation: 129
I'm trying to not set the updated_at column when i using update()
, is there any way to make it possible? thank you
Upvotes: 0
Views: 303
Reputation:
You can pass an array of options to the second parameter of the update method, which then tells laravel to not update the timestamps like so:
->update(['name' => 'foo'], ['timestamps' => false]);
Upvotes: 1
Reputation: 26258
Check your table structure, I think updated_at
is having TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
, which means this column will automatically get its value when a new value added or some changes is done on a row. So remove that ON UPDATE CURRENT_TIMESTAMP
and try again.
To check table definition try SHOW CREATE TABLE tablename
.
Upvotes: 1