*/ public function rules() { return [ 'organizer' => 'required|max:255', 'event_name' => 'required|max:255', 'completed_at' => 'required|date', 'course_id' => 'required|exists:courses,id', ]; } public function persist(Member $member, CourseMember $course): void { try { auth()->user()->api()->updateCourse($member->nami_id, $course->nami_id, $this->safe()->merge(['course_id' => Course::find($this->input('course_id'))->nami_id])->toArray()); } catch(NamiException $e) { throw ValidationException::withMessages(['id' => 'Unbekannter Fehler']); } $course->update($this->safe()->toArray()); } }