© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•7mo ago•
8 replies
Aivirth

Table widget custom filter does not update table result

I've been asked by my client to have an overview table with the most popular coupons on our site through a list with filters.
Therefore i proceeded to create the following table widget

class MostVisitedCouponsTableWidget extends BaseWidget
{
    public function getColumnSpan(): int|string|array
    {
        return ['default' => 'full'];
    }
    public function table(Table $table): Table
    {
        return $table
            ->paginated(false)
            ->query(
                Coupon::query()
                    ->select(["id", "title",  "store_id", "status"])
                    ->scopes(['published'])
                    ->withCount([
                        'impressions'
                    ])
                    ->having('impressions_count', '>', 0)
                    ->orderByDesc('impressions_count')
                    ->limit(10)
            )
            ->columns([
                TextColumn::make('id'),
                TextColumn::make('title'),
                TextColumn::make('store.business_name'),
                TextColumn::make('impressions_count')->badge(),
            ]);
    }
}
class MostVisitedCouponsTableWidget extends BaseWidget
{
    public function getColumnSpan(): int|string|array
    {
        return ['default' => 'full'];
    }
    public function table(Table $table): Table
    {
        return $table
            ->paginated(false)
            ->query(
                Coupon::query()
                    ->select(["id", "title",  "store_id", "status"])
                    ->scopes(['published'])
                    ->withCount([
                        'impressions'
                    ])
                    ->having('impressions_count', '>', 0)
                    ->orderByDesc('impressions_count')
                    ->limit(10)
            )
            ->columns([
                TextColumn::make('id'),
                TextColumn::make('title'),
                TextColumn::make('store.business_name'),
                TextColumn::make('impressions_count')->badge(),
            ]);
    }
}
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

Custom Table Widget
FilamentFFilament / ❓┊help
2y ago
Custom Table Filter
FilamentFFilament / ❓┊help
5mo ago
Custom Filter Table
FilamentFFilament / ❓┊help
3y ago
The header widget does not call on filament table filter
FilamentFFilament / ❓┊help
2y ago