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