row->id; $docter_id = $this->row->docter_id; try{ $DocOrg = new DocterOrganization(); $DocOrg->where('id',$id)->update(['state'=>1]); $count = $DocOrg->where('state','!=',1)->count(); if($count == 0){ Docter::where(['id'=>$docter_id])->update(['is_then'=>1]); } } catch (\Exception $e){ return $this->response()->error('更新失败!'); } return $this->response()->success('更新成功')->refresh(); } }