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