Adds an ordering

@param string $axisName
@param string $direction

@return static
553061
public function orderBy(string $axisName, string $direction)
    {
        $axis = $this->structure->getAxis($axisName);

        $this->orderings[] = new AxisOrdering($axis, $direction);

        return $this;
    }
1326455
public function orderBy($column, $direction)
    {
        // Ensure the sort is valid
        if (in_array($column, $this->orderable) === false
            && array_key_exists($column, $this->orderable) === false
        ) {
            return $this;
        }

        // One time skip
        $this->skipOrderingOnce = true;

        return $this->addScopeQuery(function ($query) use ($column, $direction) {

            // Get valid sort order
            $direction = in_array(strtolower($direction), ['desc', 'asc']) ? $direction : 'asc';

            // Check for table column mask
            $column = Arr::get($this->orderable, $column, $column);

            return $query->orderBy($this->appendTableName($column), $direction);
        });
    }
1002420
public function sorts($sorts, $direction = self::SORT_DESC) {
		foreach($sorts as $sort) {
			$this->sort($sort, $direction);
		}
		return $this;
	}
271448
public function addOrder($field, $direction = SORT_ASC) {
		$this->query[self::ORDER][ $field ] = $direction;
		return $this;
	}
170260
public function orderBy(string $field, string $direction = null): Select
    {
        if ($direction === null) {
            $direction = 'ASC';
        } else {
            $direction = strtoupper($direction);
        }

        if ($direction !== 'ASC' && $direction !== 'DESC') {
            throw new Exception("Can not use invalid direction order ({$direction}) in ORDER BY statement");
        }

        $this->orderBy[] = [
          'field' => $field,
          'direction' => $direction
        ];
        return $this;
    }
854639
public function orderBy($field, $direction = 'asc')
    {
        $this->sort = $field;
        $this->sortDirection = $direction;

        return $this;
    }
850975
public function add($name, $direction)
    {
        if (!in_array($name, $this->keys, true)) {
            throw new Exceptions\InvalidSorterFieldException($name);
        }
        if (!in_array($direction, ['asc', 'desc'], true)) {
            throw new Exceptions\InvalidSorterDirectionException($direction);
        }

        $field = new SorterField();
        $field->setName($name);
        $field->setDirection($direction);
        $this->values[] = $field;
    }
265540
public function setOrderDirection($direction)
    {

        $direction = strtolower($direction);

        if (!in_array($direction, ['asc', 'desc'])) {
            throw new \InvalidArgumentException('$direction must be "asc" or "desc"');
        }

        $this->orderDirection = $direction;
        return $this;
    }
512277
public function orderBy($column, $direction = IQueryBuilder::ORDER_ASC)
    {
        if ($direction == IQueryBuilder::ORDER_ASC || $direction == IQueryBuilder::ORDER_DESC) {
            $this->orderConditions[$column] = $direction;
        }

        return $this;
    }
506428
public function orderBy(
        string $cypher,
        string $direction = 'ASC'
    ): self {
        $direction = \strtolower($direction);

        $query = new self;
        $query->clauses = $this->clauses->add(
            Clause\OrderByClause::$direction($cypher)
        );

        return $query;
    }
634963
public function sortByRelation($column, $direction = 'ASC')
    {
        $relations = explode('.', $column);
        $column    = array_pop($relations);

        /** @var \Illuminate\Database\Eloquent\Model $model */
        $model = $this->repository->makeModel();

        $this->instance->getQuery()->orders = [];

        foreach ($relations as $relation) {
            /* @var Relation $relationClass */
            $this->joinRelation($relationClass = $model->{camel_case($relation)}());

            $model = $relationClass->getRelated();
        }

        $selectedColumns = $this->instance->getQuery()->columns;

        $addColumn = DB::raw("{$this->repository->makeModel()->getTable()}.*");

        if (is_array($selectedColumns) && array_search('*', $selectedColumns, true) !== null) {
            $this->instance->getQuery()->columns[array_search('*', $selectedColumns, true)] = $addColumn;
        } else {
            $this->instance->select($addColumn);
        }

        $this->instance->orderBy("{$model->getTable()}.{$column}", $direction);

        return $this;
    }
1325794
public function orderBy($column, $direction = 'asc')
    {
        return $this->order($this->mapper->getFilterPropertyName($column), $direction);
    }
439733
protected function setOrderByDirection($direction)
    {
        $direction = strtolower($direction);

        if ($direction == 'desc' || $direction == 'asc') {
            $this->orderByDirection = $direction;
        }
    }
311404
public function buildSortClosure($propertyPath, $direction)
    {
        $value = function ($data) use ($propertyPath) {
            return $this->propertyAccessor->getValue($data, $propertyPath);
        };

        if ($direction === Util\ColumnSort::ASC) {
            return function ($rowA, $rowB) use ($value) {
                $a = $value($rowA);
                $b = $value($rowB);

                if ($a == $b) {
                    return 0;
                }

                return $a < $b ? -1 : 1;
            };
        } elseif ($direction === Util\ColumnSort::DESC) {
            return function ($rowA, $rowB) use ($value) {
                $a = $value($rowA);
                $b = $value($rowB);

                if ($a == $b) {
                    return 0;
                }

                return $a > $b ? -1 : 1;
            };
        }

        throw new Exception\InvalidArgumentException("Unexpected column sort direction.");
    }
1064543
function reorder($expr, $direction = null)
    {
        $this->order(null);
        $this->order($expr, $direction);

        return $this;
    }
1136214
public function sortByEntityName($direction)
    {
        if ($this->id != '$entity') {
            throw new AnalyticsDbException('In order to sort by entity name, you need to first group by entity name.');
        }

        $direction = (int)$direction;
        $this->pipeline['$sort'] = ['_id' => $direction];

        return $this;
    }
532639
public function setOrder($mode, $direction = self::DIRECTION_ASC)
    {
        $this->orderMode = $mode;
        $this->orderDirection = $direction;
    }