contacts array sorter

This commit is contained in:
David Bomba 2016-04-17 20:40:23 +10:00
parent c84d75e7bf
commit b49938e36d

View File

@ -100,6 +100,10 @@ class ClientRepository extends BaseRepository
$contacts = isset($data['contact']) ? [$data['contact']] : $data['contacts'];
$contactIds = [];
$contacts = usort($contacts, function ($left, $right) {
return $left['priority'] - $right['priority'];
});
foreach ($contacts as $contact) {
$contact = $client->addContact($contact, $first);
$contactIds[] = $contact->public_id;