Returns the query builders sort by field.
public getSortByField ( ) : string | ||
Результат | string |
/** * Sorts LDAP search results. * * @param array $models * * @return array */ private function processSort(array $models = []) { $collection = $this->newCollection($models); $sort = [$this->builder->getSortByField() => $this->builder->getSortByDirection()]; $criteria = (new Criteria())->orderBy($sort); return $collection->matching($criteria)->toArray(); }
/** * Sorts LDAP search results. * * @param array $models * * @return Collection */ protected function processSort(array $models = []) { $field = $this->builder->getSortByField(); $flags = $this->builder->getSortByFlags(); $direction = $this->builder->getSortByDirection(); $desc = $direction === 'desc' ? true : false; return $this->newCollection($models)->sortBy(function (Model $model) use($field) { return $model->getAttribute($field, 0); }, $flags, $desc); }
/** * Sorts LDAP search results. * * @param array $models * * @return Collection */ protected function processSort(array $models = []) { $collection = $this->newCollection($models); $field = $this->builder->getSortByField(); $direction = $this->builder->getSortByDirection(); if ($direction === 'desc') { $sorted = $collection->sortByDesc($field); } else { $sorted = $collection->sortBy($field); } return $sorted; }