F
Filamentβ€’14mo ago
Jon Mason

Format number in stats widget?

I'm doing this and it works, but I want to format the value as currency. Any idea how I'd do that?
class ReportsOverview extends BaseWidget
{
protected static ?string $pollingInterval = null;

protected function getStats(): array
{
return [
Stat::make('Total', CustomerDepositsReport::sum('amount_paid'));
];
}
class ReportsOverview extends BaseWidget
{
protected static ?string $pollingInterval = null;

protected function getStats(): array
{
return [
Stat::make('Total', CustomerDepositsReport::sum('amount_paid'));
];
}
Solution:
Try with number_format() around the value
Jump to solution
2 Replies
Solution
Thijmen
Thijmenβ€’14mo ago
Try with number_format() around the value
Jon Mason
Jon MasonOPβ€’14mo ago
yep that worked. Duh. I don't know why I just expect that there's some easy filament-y way to do things that are already easy to begin with. πŸ™„
Want results from more Discord servers?
Add your server