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