Bug when editing decimal values

Hello, I trying to attach a model with a decimal pivot value. The value looks good in the table, but it does not when editing it (Cf. image). Here is my code :
TextInput::make('price')
->numeric()
->mask(
fn (TextInput\Mask $mask) => $mask
->numeric()
->decimalPlaces(2)
->decimalSeparator(',')
->mapToDecimalSeparator([','])
->normalizeZeros()
->padFractionalZeros()
)
->required()
->label('Prix (par dm²)')
->suffix('€'),
TextInput::make('price')
->numeric()
->mask(
fn (TextInput\Mask $mask) => $mask
->numeric()
->decimalPlaces(2)
->decimalSeparator(',')
->mapToDecimalSeparator([','])
->normalizeZeros()
->padFractionalZeros()
)
->required()
->label('Prix (par dm²)')
->suffix('€'),
The value is correctly stored in the database (structure : decimal(6,2) ) Thanks !
2 Replies
Dennis Koch
Dennis Koch2y ago
You need to mutate the value. money() uses cents as a base, while the form just uses your value
bouly
boulyOP2y ago
Ok thanks. I finally managed with this method.
Want results from more Discord servers?
Add your server