public function fetchSelectedItems(QueryBuilder $builder)
{
$self = $this;
$this->filters->items[] = -1;
//faço a busca de acordo com a palavra pesquisada, caso tenha uma:
if ($this->filters->searchString) {
if (count($this->filters->columns) > 0) {
$builder->where(function ($q) use($self, $builder) {
foreach ($this->filters->columns as $column) {
if (!$column->bSearchable) {
continue;
}
$builder->orWhereRaw($column->name . " LIKE '%" . $self->filters->searchString . "%'");
}
});
}
}
if ($this->filters->checkedAll == 1) {
$builder->whereNotIn($this->filters->idField, $this->filters->items);
return $builder;
}
$builder->whereIn($this->filters->idField, $this->filters->items);
return $builder;
}