repeatable entry edit modal

I have a parent record that is CourseEnrolment. It has a student who at the same time can have multiple parents. CourseEnrolment->student student->tutors I have an infolist with a repeater entry to show info from the tutors, and I put an action button to edit each tutor in a modal. but in the action, the $this->record, $livewire->record properties are CourseEnrolment(parent record) not the repeater entry record itself. How to get it?
No description
Solution:
AH, I just have to add $record at the closure, not $this->record.
Jump to solution
4 Replies
Solution
tesse05
tesse055mo ago
AH, I just have to add $record at the closure, not $this->record.
David | Fortune Validator
so sorry to jump on this. I am in a similar boat but on a TableRepeater on an edit page. Can you share your code at all? I am struggling to pass the repeater record into the action to populate a model form so I can edit the full record data. many thanks When I try to access using $record I only get the parent record from the Edit page and not the relationship record from the repeater
tesse05
tesse05OP4mo ago
Action::make('editTutor')
->label('Editar tutor/a')
->iconButton()
->icon('heroicon-o-pencil')
->modal()
->mountUsing(function (ComponentContainer $form, Tutor $record) {
return [
$form->fill([
'name' => $record->name,
'1st_surname' => $record['1st_surname'],
'2nd_surname' => $record['2nd_surname'],
'gender' => $record->gender,
'birthdate' => $record->birthdate,
'birth_city' => $record->birth_city,
'id_card_type' => $record->id_card_type,
'id_card' => $record->id_card,
'email' => $record->email,
'profession' => $record->profession,
'private_phone' => $record->private_phone,
'emergency_phone' => $record->emergency_phone,
'address' => $record->address,
'postal_code' => $record->postal_code,
'city' => $record->city,
'id_card_file' => $record->id_card_file,
]),
];
})
->form(EditForm::getSchema())
->after(function ($data, $record) {
$record->fill($data);
...
})
Action::make('editTutor')
->label('Editar tutor/a')
->iconButton()
->icon('heroicon-o-pencil')
->modal()
->mountUsing(function (ComponentContainer $form, Tutor $record) {
return [
$form->fill([
'name' => $record->name,
'1st_surname' => $record['1st_surname'],
'2nd_surname' => $record['2nd_surname'],
'gender' => $record->gender,
'birthdate' => $record->birthdate,
'birth_city' => $record->birth_city,
'id_card_type' => $record->id_card_type,
'id_card' => $record->id_card,
'email' => $record->email,
'profession' => $record->profession,
'private_phone' => $record->private_phone,
'emergency_phone' => $record->emergency_phone,
'address' => $record->address,
'postal_code' => $record->postal_code,
'city' => $record->city,
'id_card_file' => $record->id_card_file,
]),
];
})
->form(EditForm::getSchema())
->after(function ($data, $record) {
$record->fill($data);
...
})
David | Fortune Validator
Many thanks. i'll give this is a whirl
Want results from more Discord servers?
Add your server