params = $params; } /** * @param Builder $model * @param RepositoryInterface $repository * @return mixed|void */ public function apply( $model, RepositoryInterface $repository ) { if (!empty($this->params['agent_uid'])) { $model = $model->where('agent_uid', $this->params['agent_uid']); } if (!empty($this->params['username'])) { $model = $model->where('username', 'LIKE', '%'. $this->params['username'] .'%'); } if (!empty($this->params['nick'])) { $model = $model->where('nick', 'LIKE', '%'. $this->params['nick'] .'%'); } if (!empty($this->params['subject'])) { $model = $model->where('subject', 'LIKE', '%'. $this->params['subject'] .'%'); } if (!empty($this->params['module'])) { $model = $model->where('module', $this->params['module']); } if (!empty($this->params['ip'])) { $model = $model->where('ip', $this->params['ip']); } return $model; } }