Force primary contact on importing of client

This commit is contained in:
David Bomba 2023-01-07 02:52:59 +11:00
parent 76dfbddca3
commit 4af753230f

View File

@ -106,6 +106,24 @@ class CSVIngest implements ShouldQueue
$new_contact->is_primary = true; $new_contact->is_primary = true;
$new_contact->save(); $new_contact->save();
} }
Client::with('contacts')->where('company_id', $this->company->id)->cursor()->each(function ($client){
$contact = $client->contacts()->first();
$contact->is_primary = true;
$contact->save();
});
Vendor::with('contacts')->where('company_id', $this->company->id)->cursor()->each(function ($vendor){
$contact = $vendor->contacts()->first();
$contact->is_primary = true;
$contact->save();
});
} }
private function bootEngine() private function bootEngine()