model = (new ResourceSharing()); } //获取列表 public function getList(array $where) { $page_params = $this->getPageParam();//获取请求参数中的页码+分页数 $page = $page_params['page']; $limit = $page_params['limit']; $person_id = $this->member_id;//当前登录的员工id //查当前用户的归属校区 $campus_id = CampusPersonRole::where('person_id',$person_id)->value('campus_id'); //查当前用户校区下的全部员工id $person_id_arr = CampusPersonRole::where('campus_id',$campus_id) ->distinct(true) ->column('person_id'); $model = $this->model; if (!isset($where['shared_by']) && $where['shared_by'] !== '') { $model = $model->where('shared_by', $where['shared_by']); } $model = $model->whereIn('user_id', $person_id_arr); //分页查询 $res = $model->with([ 'customerResource'=>function($query){} ])->paginate([ 'list_rows' => $limit, 'page' => $page, ])->toArray(); return $res; } }