validated(); $form = new EducationForm(); $form->name = $validated['name']; $form->description = $validated['description']; $form->slug = $validated['slug']; $form->save(); return redirect()->route('education_forms.index'); } public function show(EducationForm $educationForm): View|Factory|\Illuminate\Contracts\Foundation\Application { $directions = $educationForm->directions; return view('admin.catalog.education_form.show', compact('educationForm', 'directions')); } public function edit(EducationForm $educationForm) { return view('admin.catalog.education_form.edit', compact('educationForm')); } public function update(UpdateEducationFormRequest $request, EducationForm $educationForm) { $validated = $request->validated(); $educationForm->name = $validated['name']; $educationForm->description = $validated['description']; $educationForm->slug = $validated['slug']; $educationForm->save(); return redirect()->route('education_forms.index'); } public function destroy(EducationForm $educationForm) { if ($educationForm->directions()->exists()) { return back(); } $educationForm->delete(); return redirect()->route('education_forms.index'); } }