Is it possible to modify the aggregation column query?
I am currently loading the sum of
amount
field from transactions
relation on my CoinsPack
model using the following code. The Transaction
has a status
field which can be either pending
, cancelled
and successful
and I want the sum of amount
column for only successful transactions.
5 Replies
I've tried to modify the query using the
table
method in listing page but I guess it has a bug as when added, the entire table disappears (rows and header) and only the pagination row is visible.
https://filamentphp.com/docs/3.x/panels/resources/listing-records#customizing-the-table-eloquent-query

Check if this helps you:
https://v2.filamentphp.com/tricks/aggregate-data-in-table-footer
Filament
Aggregate data in table footer (sum, avg...etc) by moaaz faracheh -...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
even though its technically for v2, i believe its more or less the same for v3
I ended up defining a new
successfulTransactions
relation on the CoinPack
and summing through it.nice, good job