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()]); })),
0 Replies
No replies yetBe the first to reply to this messageJoin