getSortByDirection() public method

Returns the query builders sort by direction.
public getSortByDirection ( ) : string
return string
示例#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();
 }
示例#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);
 }
示例#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;
 }