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