contacts array sorter
This commit is contained in:
parent
7f6f34b302
commit
d19c43edce
1 changed files with 1 additions and 4 deletions
|
|
@ -8,7 +8,6 @@ use App\Models\Contact;
|
|||
use App\Models\Activity;
|
||||
use App\Events\ClientWasCreated;
|
||||
use App\Events\ClientWasUpdated;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ClientRepository extends BaseRepository
|
||||
{
|
||||
|
|
@ -100,13 +99,11 @@ class ClientRepository extends BaseRepository
|
|||
$first = true;
|
||||
$contacts = isset($data['contact']) ? [$data['contact']] : $data['contacts'];
|
||||
$contactIds = [];
|
||||
|
||||
|
||||
usort($contacts, function ($left, $right) {
|
||||
return $right['is_primary'] - $left['is_primary'];
|
||||
});
|
||||
|
||||
Log::info($contacts);
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
$contact = $client->addContact($contact, $first);
|
||||
$contactIds[] = $contact->public_id;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue