I try to check if Instagram profile exists in my database if not exists I create it, if exists I update all fields.
InstagramProfile::updateOrCreate([
'instagram_id' => $instagramUser->data->id,
], [
'profile_id' => $author_id = Profile::firstOrCreate([
'username' => $instagramUser->data->username,
])->id,
...
]);
Problem: when it new InstagramProfile - all works ok, but when I update exists I create new Profile. Question: how prevent update some fields in updateOrCreate()?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire