This commit is contained in:
Simon Pocrnjič
2024-11-19 21:29:53 +01:00
parent e66eb6436c
commit 713bd9ffe3
4 changed files with 18 additions and 18 deletions
+3 -3
View File
@@ -34,11 +34,11 @@ protected function makeAllSearchableUsing(Builder $query): Builder
public function toSearchableArray(): array
{
$this->loadMissing('person');
$array = $this->toArray();
$array['person_full_name'] = $this->person ? $this->person->full_name: null;
$array['person'] = $this->person ? $this->person->only(['full_name', 'tax_number', 'social_security_number']): null;
$array['person_addresses'] = $this->person->addresses ? $this->person->addresses->only(['adddress'])->toArray() : [];
$array['person_phones'] = $this->person->phones ? $this->person->phones->only(['nu'])->toArray() : [];
return $array;
}