F
Filament2mo ago
Juju

$data does not contain Detail Data from Repeater

I have Master Detail create form with Repeater to handle the detail data input. How can I access the detail data in the repeater before and after save? here is the code of the repeater:
Repeater::make('details')
->label('')
->relationship('details')
->schema([
TextInput::make('details.name')
->label('Nama Pemesan')
->autocapitalize('words')
->minLength(3)
->validationAttribute('Nama pemesan')
->validationMessages([
'min' => ':attribute harus lebih dari 3 karakter',
'required' => ':attribute tidak boleh kosong',
])
->required()
->autofocus(),
Repeater::make('details')
->label('')
->relationship('details')
->schema([
TextInput::make('details.name')
->label('Nama Pemesan')
->autocapitalize('words')
->minLength(3)
->validationAttribute('Nama pemesan')
->validationMessages([
'min' => ':attribute harus lebih dari 3 karakter',
'required' => ':attribute tidak boleh kosong',
])
->required()
->autofocus(),
If it's only master I use mutateFormDataBeforeCreate() and handleRecordCreation(). Thank you in advance
1 Reply
Juju
JujuOP2mo ago
end up using handleRecordCreation(array $data) and mutateFormDataBeforeCreate(array $data) I wonder why is array $data doesn't contain the detail data from the repeater?? below is my repeater code:
Repeater::make('details')
->label('')
->relationship('details')
->minItems(1)
->validationMessages([
'min' => 'Harus ada minimal 1 data pemesan',
])
->schema([
TextInput::make('details.name')
->label('Nama Pemesan')
->autocapitalize('words')
->minLength(3)
->validationAttribute('Nama pemesan')
->validationMessages([
'min' => ':attribute harus lebih dari 3 karakter',
'required' => ':attribute tidak boleh kosong',
])
->required()
->autofocus(),
])
Repeater::make('details')
->label('')
->relationship('details')
->minItems(1)
->validationMessages([
'min' => 'Harus ada minimal 1 data pemesan',
])
->schema([
TextInput::make('details.name')
->label('Nama Pemesan')
->autocapitalize('words')
->minLength(3)
->validationAttribute('Nama pemesan')
->validationMessages([
'min' => ':attribute harus lebih dari 3 karakter',
'required' => ':attribute tidak boleh kosong',
])
->required()
->autofocus(),
])
Want results from more Discord servers?
Add your server