updateOrInsert is a QueryBuilder method ?
Jul 3, 2022
11
Level 2
updateOrCreate not touching timestamps?
Hello,
I have a question of my own. It seems that updateOrCreate doesn't touch created_at and updated_at when creating a new row. I'm very surprised, I don't recall such a behavior with Laravel.
Plus the documentation says:
The upsert method will automatically set the created_at and updated_at timestamps
This concerns the upsert method but how comes upsert and updateOrCreate have different behaviors?
My snippet:
Payment::updateOrInsert(
['charge_id' => $charge_id],
[
'user_id' => $user->id,
'price_id' => $price->id,
'status' => $status
]
);
Thanks
Level 122
@axeloz but you are using updateOrInsert and then reading the docs for updateOrCreate
Please or to participate in this conversation.