dependent Select filter not applying on table
Filter::make('filter')
->form([
Select::make('DistrictId')
->label('Select District')
->relationship('district', 'Name')
->reactive(),
// the work if single ad will be selected automatically
//->afterStateHydrated(fn(callable $set)=>$set('AdId',null)),
Select::make('AdId')
->label('Select AD')
->options(
function (callable $get) {
Log::info($get('DistrictId'));
$districtId = $get('DistrictId');
if ($districtId) {
return Staff::query()
->where('district_id', $districtId)
->where('designation', 'Assistant Director')
->pluck('staff_name');
//->toArray();
} else {
return [];
}
// Log::info($staffNames);
//return $staffNames;
}
)
->reactive()
->afterStateHydrated(fn(callable $set) => $set('AdId', null)),
]),
i have done the code above the filter is dependent and working but not been apply on the table
0 Replies