Handle single contact object passed into array
This commit is contained in:
parent
bfff515b59
commit
b35bdebccf
1 changed files with 8 additions and 2 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue