Check if is_primary is set when sorting contacts
This commit is contained in:
parent
76f5ef92f7
commit
4248963d92
1 changed files with 2 additions and 1 deletions
|
|
@ -100,8 +100,9 @@ class ClientRepository extends BaseRepository
|
|||
$contacts = isset($data['contact']) ? [$data['contact']] : $data['contacts'];
|
||||
$contactIds = [];
|
||||
|
||||
// If the primary is set ensure it's listed first
|
||||
usort($contacts, function ($left, $right) {
|
||||
return $right['is_primary'] - $left['is_primary'];
|
||||
return (isset($right['is_primary']) ? $right['is_primary'] : 0) - (isset($left['is_primary']) ? $left['is_primary'] : 0);
|
||||
});
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue