params = $arams; } public function apply($model, RepositoryInterface $repository) { if (!empty($this->params['type'])) { $model = $model->where('type', $this->params['type']); } if (!empty($this->params['user_uid'])) { $model = $model->where('user_uid', $this->params['user_uid']); } if (!empty($this->params['way'])) { $model = $model->where('way', $this->params['way']); } if (!empty($this->params['user_uid'])) { $model = $model->where('user_uid', $this->params['user_uid']); } if (!empty($this->params['currency_type'])) { $model = $model->where('currency_type', $this->params['currency_type']); } if (!empty($this->params['username'])) { $model = $model->whereHas('oneUser', function ($query) { $query->where('nick', 'like', '%'. $this->params['username'] .'%'); }); } return $model; } }