fix 6
This commit is contained in:
parent
e66eb6436c
commit
713bd9ffe3
|
|
@ -34,17 +34,13 @@ protected function makeAllSearchableUsing(Builder $query): Builder
|
|||
|
||||
public function toSearchableArray(): array
|
||||
{
|
||||
|
||||
/*$person = [
|
||||
'full_name' => $this->person->full_name,
|
||||
'addresses' => $this->person->addresses,
|
||||
'phones' => $this->person->phones
|
||||
];*/
|
||||
$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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class Person extends Model
|
|||
];
|
||||
|
||||
protected $hidden = [
|
||||
'id',
|
||||
'deleted',
|
||||
'user_id'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
use App\Http\Controllers\ContractController;
|
||||
use App\Http\Controllers\SettingController;
|
||||
use App\Models\Person\Person;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use ArielMejiaDev\LarapexCharts\LarapexChart;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
|
@ -50,15 +51,17 @@
|
|||
})
|
||||
->get();*/
|
||||
$clients = App\Models\Client::search($request->input('query'))
|
||||
->get()
|
||||
->load('person:id,full_name')
|
||||
->take(5);
|
||||
->query( fn(Builder $builder) =>
|
||||
$builder->with('person:id,full_name')->limit($request->input('limit'))
|
||||
)
|
||||
->get();
|
||||
|
||||
$clientCases = App\Models\ClientCase::search($request->input('query'))
|
||||
->get()
|
||||
->load('person:id,full_name')
|
||||
->take(5);
|
||||
|
||||
->query( fn(Builder $builder) =>
|
||||
$builder->with('person:id,full_name')->limit($request->input('limit'))
|
||||
)
|
||||
->get();
|
||||
|
||||
|
||||
return [
|
||||
'clients' => $clients,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user