Custom summaries (Sum of other column)
Hi All,
I'm looking at https://filamentphp.com/docs/3.x/tables/summaries#custom-summaries
For a summary of a different column.
I have a table where i show Hours. Only Hours is a attribute in de model and not a column in the tabel. So when i want to Sum the "hours" i get a error 500 that the query is bad.
Now i want to summarize this column only with the real column in the database in this case the column is amount that needs to sum.
With below settings that i got from Custom summaries the summory wont show anythin it doe not pop-up nor does it gives me a error.
'''
TextColumn::make('hours')
->sortable()
->summarize(
Summarizer::make()
->label('First last name')
->using(fn (Builder $query): string => $query->sum('amount'))
),
'''
Does anyone know how to summarize a different column than the original one?
Thanks.
0 Replies