How to apply current filters to Columns using summaries?

HI there, I am using sum() on TextColumn and Filter on relationships. But it seems the sum columns are not scoped by the filter? Is there any solution to this? I can't find a hint in the documentation. Appreciate your help. Thanks
1 Reply
Patrick
PatrickOP7mo ago
Solution was provided by Kenneth Sese TextColumn::make('order_items_sum') ->sum(fn ($livewire) => ['orderItems' => function ($query) use ($livewire) { // dump the tableFilters to see the array structure so you can get the value. Probably want to use data_get() with wildcards) dd($livewire->tableFilters); return $query->where('your_table_filter', 'your_value'); }]),
Want results from more Discord servers?
Add your server