Hi, this works great. I did make a slight change as my reminders table uses polymorphism, so I use the reminders form in multiple locations.
I take all the reminders and put them in their own public property. This allows me to use $reminders as $reminder
in the form.
public Student $student;
public $reminders;
public Reminder $editing;
public function mount(Student $student)
{
$this->student = $student->load( 'reminders');;
$this->reminders = $this->student->reminders;
}
Then in my save method I have the following:
public function save()
{
// save actions
$this->validate([
'editing.reminder_body' => 'required|min:3|max:255',
'editing.reminder_at' => 'required|date',
'editing.completed_at' => 'nullable|date'
]);
$this->student->reminders()->save($this->editing);
$this->student = $this->student->refresh();
$this->reminders = $this->student->reminders;
// close bootstrap modal
$this->dispatchBrowserEvent('closeModal');
}
This all works really well now!
Thanks for your help.