params = $params; } public function apply($model, RepositoryInterface $repository) { if (!empty($this->params['goods_uid'])) { $model = $model->where('goods_uid', $this->params['goods_uid']); } if (!empty($this->params['goods_name'])) { $model = $model->where('goods_name', 'LIKE', '%'. $this->params['goods_name'] .'%'); } if (!empty($this->params['buy_uid'])) { $model = $model->where('buy_uid', $this->params['buy_uid']); } return $model; } }