Sum summarizer not respecting MoneyCast in table output

I'm following along with the 'Getting Started' tutorial and trying out table summaries but seem to have hit a problem. The summary is summing up the integer amounts from the price column but I want to display it as dictated in MoneyCast (2DP), - can this be done on a summarizer? Loving Filament so far, by the way! 😉
Tables\Columns\TextColumn::make('price')
->money('GBP')
->sortable()
->summarize([
Summarizers\Sum::make()->money('GBP'),
])
Tables\Columns\TextColumn::make('price')
->money('GBP')
->sortable()
->summarize([
Summarizers\Sum::make()->money('GBP'),
])
No description
3 Replies
dissto
dissto7mo ago
There is also a divideBy argument for money() that allows you to divide the original value by a number before formatting it. This could be useful if your database stores the price in cents, for example:
See: https://filamentphp.com/docs/3.x/tables/summaries#currency-formatting
awcodes
awcodes7mo ago
It’s still just OOP, if you need something specific to your use case there no reason you can’t override the base class to return exactly what you need.
Aethyrion
AethyrionOP7mo ago
Perfect - thanks!
Want results from more Discord servers?
Add your server