mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
contacts array sorter
This commit is contained in:
parent
7f6f34b302
commit
d19c43edce
@ -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…
x
Reference in New Issue
Block a user