'=', 'created_at' => 'like', ]; public function model() { return Model::class; } /** * 数据格式化 * * @param mixed $result * * @return mixed */ public function transform($model) { return $model->toArray(); } /** * 查询条件 * * @return void */ public function withConditions(array $conditions = []) { if (isset($conditions['id'])) { $conditions['id'] = array_wrap($conditions['id']); $this->model = $this->model->whereIn('id', $conditions['id']); } if (isset($conditions['company_id'])) { $this->model = $this->model->where('company_id', $conditions['company_id']); } if (isset($conditions['contacts'])) { $this->model = $this->model->where('contacts', $conditions['contacts']); } if (isset($conditions['mobile'])) { $this->model = $this->model->where('mobile', $conditions['mobile']); } if (isset($conditions['area'])) { $this->model = $this->model->where('area', $conditions['area']); } if (isset($conditions['address'])) { $this->model = $this->model->where('address', $conditions['address']); } return $this; } }