© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Aminne

Adding where condition for filter in statsOverviewWidget

Tables\Filters\SelectFilter::make('category')
                    ->relationship('categories', 'name')
                    ->searchable()
                    ->preload()
Tables\Filters\SelectFilter::make('category')
                    ->relationship('categories', 'name')
                    ->searchable()
                    ->preload()


use InteractsWithPageTable;

    protected function getTablePage(): string
    {
        return ListPosts::class;
    }

    protected function getStats(): array
    {
        return [
            BaseWidget\Stat::make('Published Post', $this->getPageTableQuery()
                ->with('categories')
                ->whereRelation('category', 'title', '', '')
                ->where('status', 'published')
                ->count())
                ->description('All published posts')
                ->color('success'),
use InteractsWithPageTable;

    protected function getTablePage(): string
    {
        return ListPosts::class;
    }

    protected function getStats(): array
    {
        return [
            BaseWidget\Stat::make('Published Post', $this->getPageTableQuery()
                ->with('categories')
                ->whereRelation('category', 'title', '', '')
                ->where('status', 'published')
                ->count())
                ->description('All published posts')
                ->color('success'),
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Adding condition for reordering
FilamentFFilament / ❓┊help
3y ago
How to Add Month Filter to FilamentPHP StatsOverviewWidget?
FilamentFFilament / ❓┊help
9mo ago
adding table filter in action->url()
FilamentFFilament / ❓┊help
3y ago
Advanced Tables Filter Not Adding Filter
FilamentFFilament / ❓┊help
16mo ago