Upsert doesnt work?
Binternet opened this issue · 1 comments
Binternet commented
I am trying to update the property for a given model, yet it keeps creating a new entry instead of updating the existing one even though I've set the $primaryKey
attribute on the class to uuid
:
$cf = \App\Models\MyModel::updateOrCreate([
'uuid' => 13,
'domain_name' => 'mytest.com'
]);
Binternet commented
My bad, the correct way is to pass two arrays, first one is for the lookup attributes and the second one is for the values:
$cf = \App\Models\MyModel::updateOrCreate([
'uuid' => 13,
], [
'domain_name' => 'mytest.com'
]);