public function postEditMajor(NganhRequest $request, $id) { $nganhs = Nganh::where('id', $id)->get(); if ($nganhs == null) { return redirect()->action('UniversityStaffController@getListMajor'); } $nganh = $nganhs->first(); $nganh->tennganh = $request->txtTenNganh; $nganh->manganh = $request->txtMaNganh; $nganh->diemchuan = $request->txtDiemChuan; $nganh->truong_id = Truong::where('nhanvienquanly_user_id', Auth::user()->id)->get()->first()->id; $nganh->save(); return redirect()->action('UniversityStaffController@getListMajor')->with(['flash_level' => 'success', 'flash_message' => 'Sửa ngành thành công!']); }