$this->service->getGrades(), ]); } /** * Display a listing of the resource. */ public function index(Grade $grade): View { return view('grade-lesson.index', [ 'lessons' => $this->service->getAll($grade), 'grade' => $grade, 'subjects' => $grade->subjects, ]); } /** * Show the form for creating a new resource. */ public function create(Grade $grade): View { return view('grade-lesson.create', [ 'types' => TypeLesson::cases(), 'grade' => $grade, ]); } /** * Store a newly created resource in storage. */ public function store(LessonPostRequest $request, Grade $grade): RedirectResponse { return redirect()->route( 'grades.lessons.show', [ $grade, $this->service->create($request->validated()) ] ); } /** * Display the specified resource. */ public function show(Grade $grade, Lesson $lesson): View { return view('grade-lesson.show', [ 'lesson' => $lesson, 'grade' => $grade, ]); } /** * Show the form for editing the specified resource. */ public function edit(Grade $grade, Lesson $lesson): View { return view('grade-lesson.edit', [ 'lesson' => $lesson, 'grade' => $grade, 'types' => TypeLesson::cases(), ]); } /** * Update the specified resource in storage. */ public function update(LessonPostRequest $request, Grade $grade, Lesson $lesson): RedirectResponse { return redirect()->route( 'grades.lessons.show',[ $grade, $this->service->update($lesson, $request->validated()) ] ); } /** * Remove the specified resource from storage. */ public function destroy(Grade $grade, Lesson $lesson): RedirectResponse { $this->service->delete($lesson); return redirect()->route('grades.lessons.index', $grade); } }