diff --git a/app/Filament/Pages/Dashboard.php b/app/Filament/Pages/Dashboard.php index b179fe0..4a8ea26 100644 --- a/app/Filament/Pages/Dashboard.php +++ b/app/Filament/Pages/Dashboard.php @@ -44,11 +44,18 @@ protected function getHeaderActions(): array ->label('Reset Filter') ->icon(Heroicon::XMark) ->color('danger') - ->action(function () { - $this->filters['startDate'] = null; - $this->filters['endDate'] = null; - }) + ->action(fn () => $this->resetFilters()) ->visible(fn () => ! empty($this->filters['startDate']) || ! empty($this->filters['endDate'])), ]; } + + public function resetFilters(): void + { + $this->filters['startDate'] = null; + $this->filters['endDate'] = null; + + if (method_exists($this, 'getFiltersSessionKey')) { + session()->forget($this->getFiltersSessionKey()); + } + } }