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