params = $params; } /** * @param Builder $model * @param RepositoryInterface $repository * @return mixed|void */ public function apply( $model, RepositoryInterface $repository ) { if (!empty($this->params['uid'])) { $model = $model->where('uid', $this->params['uid']); } if (isset($this->params['type'])) { $type = intval($this->params['type']); $model = $model->where('type', $type); } if (isset($this->params['status'])) { $status = intval($this->params['status']); $model = $model->where('status', $status); } if (isset($this->params['title'])) { $title = trim($this->params['title']); $model = $model->where('title', 'LIKE' , '%'.$title.'%'); } return $model; } }