Custom filter count is zero

I have made a custom DateFilter:
DateFilter::make('date'),
DateFilter::make('date'),
It extends the SelectFilter:
class DateFilter extends 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;
});
}
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;
});
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server