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' ];