builder; } return $this->builder->where(function ($query) use ($filter) { $query->where('name', 'like', '%'.$filter.'%') ->orWhere('public_notes', 'like', '%'.$filter.'%') ->orWhere('private_notes', 'like', '%'.$filter.'%'); }); } /** * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Eloquent\Query\Builder */ public function sort(string $sort) :Builder { $sort_col = explode('|', $sort); if(is_array($sort_col)) return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** * Filters the query by the users company ID. * * @return Illuminate\Eloquent\Query\Builder */ public function entityFilter() :Builder { return $this->builder->company(); } }