#repeatable entry edit modal

6 messages · Page 1 of 1 (latest)

jaunty tinsel
#

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?

simple cliffBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

jaunty tinsel
#

AH, I just have to add $record at the closure, not $this->record.

simple cliffBOT
boreal hare
# jaunty tinsel AH, I just have to add $record at the closure, not $this->record.

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

jaunty tinsel
# boreal hare so sorry to jump on this. I am in a similar boat but on a TableRepeater on an ed...
                       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);
...
})