F
Filament17mo ago
Antoine

Date filters doesn't count

Hi everybody, I raise a topic that has surely been mentioned but I couldn't find an answer between Discord and GitHub or in the documentation. When I use Simple Filters on my ->filters() method. The count badge accumulates. Out I created a filter that defines a range of dates as in the documentation however this one is not counted in the count of filters of my table. This aspect is perhaps intended? How can I add these non-empty filters to the active filters count? On the image, we can clearly see that the count is at 0 despite the 2 filters being filled. Here is my code: ->filters([ Filter::make('created_at') ->form([ DatePicker::make('created_from') ->columnSpan(6), DatePicker::make('created_until') ->columnSpan(6), ]) ->query(function (Builder $query, array $data): Builder { return $query ->when( $data['created_from'], fn(Builder $query, $date): Builder => $query->whereDate('created_at', '>=', $date), ) ->when( $data['created_until'], fn(Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date), ); }) ->columns(12), ]) ->filtersFormWidth('md')
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server