filters
Iam using SelectFilter in resource, while selecting item in a filter the table data not filtering, only when i reload the page that time only filtering, why like this? and my code will be like
->filters([
SelectFilter::make('day_id')
->label('Day')
->options(fn () => WeekDay::whereNot('id', config('constants.weekend_day.sunday'))->get()->pluck('name', 'id')->toArray())
->query(function (Builder $query, array $data) {
if (!empty($data['value'])) {
$query->where('day_id', $data['value']);
}
}),
])
3 Replies