© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Aditya Khadka | Nepal

Update sum on filter

Hello, community. I have a table showing how many times users have ordered with the amount. When I do the date filter, I need to fetch a user with an order between that date which is already done and update the table result accordingly which is total order within that date and amount.

my table code is
Tables\Columns\TextColumn::make('total_order')
->color('primary')
->default(fn (Customer $record) => $record->orders->count())
->description(fn (Customer $record): string => "€{$record->orders ->sum('total')}")
->label('Total Order'),

and my filter code is

//this week
Filter::make('This Week')
->query(fn (Builder $query): Builder => $query->whereHas('orders', function (Builder $query) {
$query->whereBetween('created_at', [now()->startOfWeek(), now()->endOfWeek()]);
})),
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

update actions on filter change
FilamentFFilament / ❓┊help
3y ago
show total sum by filters
FilamentFFilament / ❓┊help
14mo ago
Sum On Third Level Relatiohsip
FilamentFFilament / ❓┊help
3y ago
Filter test FAILED `filterTable` doesn't work
FilamentFFilament / ❓┊help
13mo ago