From e66eb6436cf176346095b4c1b125c2a23dd1141a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Pocrnji=C4=8D?= Date: Tue, 19 Nov 2024 20:47:46 +0100 Subject: [PATCH] fix 5 --- app/Models/Client.php | 3 ++- app/Models/ClientCase.php | 4 +++- app/Models/Person/Person.php | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Models/Client.php b/app/Models/Client.php index c42f570..36c27c8 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -40,10 +40,11 @@ public function toSearchableArray(): array 'addresses' => $this->person->addresses, 'phones' => $this->person->phones ];*/ + $this->loadMissing('person'); $array = $this->toArray(); - $array['person'] = $this->person ? $this->person->only('full_name') : null; + $array['person_full_name'] = $this->person ? $this->person->full_name: null; return $array; } diff --git a/app/Models/ClientCase.php b/app/Models/ClientCase.php index f7507da..2cf9610 100644 --- a/app/Models/ClientCase.php +++ b/app/Models/ClientCase.php @@ -34,9 +34,11 @@ protected function makeAllSearchableUsing(Builder $query): Builder public function toSearchableArray(): array { + $this->loadMissing('person'); + $array = $this->toArray(); - $array['person'] = $this->person ? $this->person->only('full_name') : null; + $array['person_full_name'] = $this->person ? $this->person->full_name: null; return $array; } diff --git a/app/Models/Person/Person.php b/app/Models/Person/Person.php index ea93797..cf57ed7 100644 --- a/app/Models/Person/Person.php +++ b/app/Models/Person/Person.php @@ -42,7 +42,6 @@ class Person extends Model ]; protected $hidden = [ - 'id', 'deleted', 'user_id' ];