Vinelab / NeoEloquent

The Neo4j OGM for Laravel
MIT License
633 stars 197 forks source link

Upsert doesnt work? #370

Closed Binternet closed 1 year ago

Binternet commented 1 year ago

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 1 year ago

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'
        ]);