F
Filament2mo ago
daniik

Filter not apply on table query

Hi, I have a problem with a filter query that does not apply to the table. The property type is not database-based, but I take it from other models. So I have a scope ready that returns a query in this form:
select * from subscriptions where subscriptions.id in (11)
select * from subscriptions where subscriptions.id in (11)
The filter query returns the correct SQL query of the same form, but when I apply the filter, it does not appear in the table. Do you have any idea why?
Tables\Filters\SelectFilter::make('type')
->label(__('subscription.properties.type'))
->options(AbonentPackageType::class)
->native(false)
->query(function ($query, $state) {
$type = AbonentPackageType::tryFrom($state['value']);

if ($type === null) {
return $query;
}

return $query->wherePackageType($type);
})
Tables\Filters\SelectFilter::make('type')
->label(__('subscription.properties.type'))
->options(AbonentPackageType::class)
->native(false)
->query(function ($query, $state) {
$type = AbonentPackageType::tryFrom($state['value']);

if ($type === null) {
return $query;
}

return $query->wherePackageType($type);
})
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?