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