This commit is contained in:
Simon Pocrnjič 2024-11-19 20:47:46 +01:00
parent 1620136d7d
commit e66eb6436c
3 changed files with 5 additions and 3 deletions

View File

@ -40,10 +40,11 @@ public function toSearchableArray(): array
'addresses' => $this->person->addresses, 'addresses' => $this->person->addresses,
'phones' => $this->person->phones 'phones' => $this->person->phones
];*/ ];*/
$this->loadMissing('person');
$array = $this->toArray(); $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; return $array;
} }

View File

@ -34,9 +34,11 @@ protected function makeAllSearchableUsing(Builder $query): Builder
public function toSearchableArray(): array public function toSearchableArray(): array
{ {
$this->loadMissing('person');
$array = $this->toArray(); $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; return $array;
} }

View File

@ -42,7 +42,6 @@ class Person extends Model
]; ];
protected $hidden = [ protected $hidden = [
'id',
'deleted', 'deleted',
'user_id' 'user_id'
]; ];