setBaseQuery($this->alias, [ ['goods', 'goods_id'], ['user', 'user_id'], ]); // 检索查询条件 if (!empty($search)) { $this->where(function ($query) use ($search) { $query->whereOr('goods.goods_name', 'like', "%{$search}%") ->whereOr('user.nickName', 'like', "%{$search}%"); }); } // 返回列表数据 return $this->with(['goods.image.file', 'user']) ->where("{$this->alias}.is_delete", '=', 0) ->order(["{$this->alias}.create_time" => 'desc']) ->paginate(15, false, [ 'query' => request()->request() ]); } }