/** * @param Request $request * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ public function update(Request $request) { if ($request->ajax()) { $specialization = Specialization::find($request->input('id')); if (is_null($specialization)) { return response()->json(['success' => false, 'msg' => 'Такой специальности не существует'], 422); } $specialization->update($request->all()); return response()->json(['msg' => 'Специальность обновлена. Обновите страницу.']); } return redirect()->back()->with('msg', $this->no_js); }
/** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index() { $specializations = Specialization::all(); return view('specialization.index', ['specializations' => $specializations]); }