From b35bdebccf938537759f1726f8afcbdaa272acf1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Sep 2022 17:41:37 +1000 Subject: [PATCH] Handle single contact object passed into array --- app/Repositories/ClientContactRepository.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Repositories/ClientContactRepository.php b/app/Repositories/ClientContactRepository.php index 8bd7e941b720..b39ee68133cc 100644 --- a/app/Repositories/ClientContactRepository.php +++ b/app/Repositories/ClientContactRepository.php @@ -29,9 +29,15 @@ class ClientContactRepository extends BaseRepository public function save(array $data, Client $client) : void { - if (isset($data['contacts'])) { + if (isset($data['contacts']) && (count($data['contacts']) !== count($data['contacts'], COUNT_RECURSIVE))) { $contacts = collect($data['contacts']); - } else { + } elseif(isset($data['contacts'])){ + + $temp_array[] = $data['contacts']; + $contacts = collect($temp_array); + + } + else { $contacts = collect(); }