sortBy('position'); return view('admin.admission.index', compact('admissions')); } public function create() { $admissions = Admission::all()->sortBy('position'); return view('admin.admission.create', compact('admissions')); } public function store(StoreAdmissionRequest $request) { $validated = $request->validated(); $admission = new Admission(); $admission->name = $validated['name']; $admission->description = $validated['description']; $admission->slug = $validated['slug']; $admission->position = $validated['position']; $admission->save(); return redirect()->route('admissions.index'); } public function show(Admission $admission) { return view('admin.admission.show', compact('admission')); } public function edit(Admission $admission) { return view('admin.admission.edit', compact('admission')); } public function update(UpdateAdmissionRequest $request, Admission $admission) { $validated = $request->validated(); $admission->name = $validated['name']; $admission->description = $validated['description']; $admission->slug = $validated['slug']; $admission->position = $validated['position']; $admission->save(); return redirect()->route('admissions.index'); } /** * Remove the specified resource from storage. */ public function destroy(Admission $admission) { if ($admission->documents()->exists()) { return back(); } $admission->delete(); return redirect()->route('admissions.index'); } }