Help formating a data in a repeater
Hello everybodyI I have a problem formating data in a TextInput inside a Repater. The data in the array is coming as 86.7 and I want it as 86.70. I tried using the method
->formatStateUsing(fn($state) => number_format($state))
but do not even execute it. Please can you help me?
This is how my code looks:
Repeater::make('unpaid_invoices')
->schema([
TextInput::make('invoice_number')
->label('Invoice #')
->disabled(),
TextInput::make('invoice_date')
->label('Date')
->disabled(),
TextInput::make('open_balance')
->label('Total Due')
->prefix('$')
->formatStateUsing(function ($state) {
return number_format($state, 2);
})
])
->label('Unpaid Invoices')
1 Reply
put it in to dump($state) or dump($record) by passing $record in to function and see, how it'scoming from model.