$teacher, 'subjects' => $this->service->getAllSubjects(), ]); } public function store(SubjectTeacherPostRequest $request, Teacher $teacher): RedirectResponse { return redirect()->route('teachers.show', $this->service->create($request->validated(), $teacher)); } public function show(Teacher $teacher, Subject $subject): View { return view('subject-teacher.show', [ 'teacher' => $teacher, 'subject' => $subject, 'grades' => $this->service->getGrades($teacher, $subject), ]); } public function edit(Teacher $teacher, Subject $subject): View { return view('subject-teacher.edit', [ 'teacher' => $teacher, 'updateSubject' => $subject, 'subjects' => $this->service->getAllSubjects(), ]); } public function update(SubjectTeacherPostRequest $request, Teacher $teacher, Subject $subject): RedirectResponse { return redirect()->route('teachers.show', $this->service->update($teacher, $request->validated(), $subject)); } public function destroy(Teacher $teacher, Subject $subject): RedirectResponse { return redirect()->route('teachers.show', $this->service->delete($teacher, $subject)); } }