role == 2){ return $this->response()->error('请在设备中解绑')->refresh(); } foreach ($collection as $model) { $ids[]=$model->id; } $res = UserDevice::where('user_id',$uid)->whereIn('device_id',$ids)->delete(); if ($res) return $this->response()->info('解除绑定成功')->refresh(); return $this->response()->error('操作失败,请重试')->refresh(); } public function dialog() { $this->confirm('确定把该用户的所有设备解绑?'); } }