getSortByDirection() public method

Returns the query builders sort by direction.
public getSortByDirection ( ) : string
return string
Exemplo n.º 1
0
 /**
  * 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();
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 /**
  * 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;
 }