© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago
Kiran Timsina

Tab Badge not updating

I have a tab in ListBlogPosts where i have two tabs with badge that has count.

I want the count to be dyanamically updated based on my active filter. Sadly, the count does not update. Probably the code to generate the badge does not run on filter change. Is there a way to achieve it?

public function getTabs(): array
    {
        $filterYear = $this->getTableFilterState('publish_year')['value'];
        $filterMonth = $this->getTableFilterState('publish_month')['value'];

        return [
            'all' => Tab::make(),

            'waiting_for_assignees' => Tab::make()
                ->modifyQueryUsing(fn (Builder $query) => $query
                    ->where(fn ($q) => $q->whereDoesntHave('website.blogAssigned')->orDoesntHave('website.seoSupportAssigned'))
                )
                ->label('Waiting for Assignees')
                ->badge(fn () => BlogPost::where(fn ($q) => $q->whereDoesntHave('website.blogAssigned')->orDoesntHave('website.seoSupportAssigned'))
                    ->whereYear('publish_date', $filterYear)
                    ->whereMonth('publish_date', $filterMonth)
                    ->count()),

            'waiting_for_title' => Tab::make()
                ->modifyQueryUsing(fn (Builder $query) => $query
                    ->whereNull('title')
                )
                ->label('Waiting for Title')
                ->badge(fn () => BlogPost::whereNull('title')
                    ->whereYear('publish_date', $filterYear)
                    ->whereMonth('publish_date', $filterMonth)
                    ->count()
                ),
          ];
    }
public function getTabs(): array
    {
        $filterYear = $this->getTableFilterState('publish_year')['value'];
        $filterMonth = $this->getTableFilterState('publish_month')['value'];

        return [
            'all' => Tab::make(),

            'waiting_for_assignees' => Tab::make()
                ->modifyQueryUsing(fn (Builder $query) => $query
                    ->where(fn ($q) => $q->whereDoesntHave('website.blogAssigned')->orDoesntHave('website.seoSupportAssigned'))
                )
                ->label('Waiting for Assignees')
                ->badge(fn () => BlogPost::where(fn ($q) => $q->whereDoesntHave('website.blogAssigned')->orDoesntHave('website.seoSupportAssigned'))
                    ->whereYear('publish_date', $filterYear)
                    ->whereMonth('publish_date', $filterMonth)
                    ->count()),

            'waiting_for_title' => Tab::make()
                ->modifyQueryUsing(fn (Builder $query) => $query
                    ->whereNull('title')
                )
                ->label('Waiting for Title')
                ->badge(fn () => BlogPost::whereNull('title')
                    ->whereYear('publish_date', $filterYear)
                    ->whereMonth('publish_date', $filterMonth)
                    ->count()
                ),
          ];
    }
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

Refresh tab badge
FilamentFFilament / ❓┊help
3y ago
Refresh tab badge
FilamentFFilament / ❓┊help
3y ago
Tab badge count not refreshing and toggle with tab is not animating
FilamentFFilament / ❓┊help
3y ago
Updating value of Navigation Badge
FilamentFFilament / ❓┊help
2y ago