FilamentF
Filament17mo ago
1 reply
javalava6985

Custom filter count is zero

I have made a custom DateFilter:

DateFilter::make('date'),

It extends the SelectFilter:

class DateFilter extends SelectFilter


In the setUp method i have used $this->indiscateUsing(). This displays the indicators but it does not update the filter count. I can see in the docs that i need to use the ->indicateUsing for the count to update but how do i make it work with a custom filter?

protected function setUp(): void {
        Parent::setUp();
        $this->indicateUsing(function (array $data): array {
              $indicators = [];
              if ($data['date_from'] ?? null) {
                  $indicators[] = Indicator::make('Vanaf  ' . Carbon::parse($data['date_from'])->format('d-m-Y'))
                    ->removeField('date_from');
              }
              if ($data['date_until'] ?? null) {
                  $indicators[] = Indicator::make('Vanaf  ' . Carbon::parse($data['date_until'])->format('d-m-Y'))
                    ->removeField('date_until');
              }

        return $indicators;
        });
    }
Was this page helpful?