->money() is rounding?

Using this text column
TextColumn::make('total_pay')
->label('Total Pay')
->alignCenter()
->toggleable()
->money(fn ($record) => $record->currency ?? 'EUR', 0)
->summarize([
Tables\Columns\Summarizers\Sum::make()
->money('EUR', 100)
->label('Total'),
])
->default(0),
TextColumn::make('total_pay')
->label('Total Pay')
->alignCenter()
->toggleable()
->money(fn ($record) => $record->currency ?? 'EUR', 0)
->summarize([
Tables\Columns\Summarizers\Sum::make()
->money('EUR', 100)
->label('Total'),
])
->default(0),
is not keeping two decimal places. How do we ensure it is formatted two 2 decimals / relative to the currency? The state is correct i.e. 160.02, but the displayed money value is £160
2 Replies
egmose5492dk
egmose5492dk8mo ago
->numeric(decimalPlaces: 2)
toeknee
toekneeOP8mo ago
No, that overrides money(). numeric isn't the issue as we already format it earlier and it's already 160.02. But money rounds it.
Want results from more Discord servers?
Add your server