FilamentF
Filament2y ago
DeDe

How to not display data in widget table except if a filter is selected ?

Hi,

I want to display data only if a filter is selected by user.
If anyone can help me, it will be appreciate !

Thanks for your help !
Solution
Maybe this?
->modifyQueryUsing(function (Builder $query, Table $table) {
    $query->when(! $table->isFiltered(), fn (Builder $query): Builder => $query->whereId(0));
})
Was this page helpful?