Add an ORDER BY column and direction

@param string $column
@param string $direction
@return $this
358857
function orderBy( $column, $direction = "ASC" ) {

        $clone = clone $this;

        if ($direction===true) {
            $clone->orderBy[] = $column;
        }else{
            $clone->orderBy[] = $this->db->quoteIdentifier( $column ) . " " . $direction;
        }

        return $clone;

    }
1110059
public function orderBy($index, $direction = 'desc')
    {
        if ($direction != 'desc') {
            $direction = 'asc';
        }

        if (is_array($index)) {
            $this->attributes['order'][] = $index;
        } else {
            $this->attributes['order'][] = [$index, $direction];
        }

        return $this;
    }
1099454
public function multiSortBy(array $columns)
    {
        foreach ($columns as $column => $direction) {
            if (strpos($column, '.')) {
                $this->sortByRelation($column, $direction);
            } else {
                $this->sortBy($column, $direction);
            }
        }

        return $this;
    }
672751
public function orderBy($fields, $direction = false)
    {
        $this->orderBy->addFields($fields, $direction);

        return $this;
    }
489214
public function orderBy(array $columns_and_direction) {
		// for each given parameter
		foreach($columns_and_direction as $column => $direction) {
			// if the direction is not valid force ASC
			$direction == 'ASC' || $direction == 'DESC' ?: $direction = 'ASC';
			// secure the column name
			list($column) = Query\Convert::columnToPlaceholder($this->Quote ,$column);
			// push it
			$this->Order[] = "{$column} $direction";
		}
		// return self to the next method
		return $this;
	}
594036
public function orderBy($field, $direction = NULL) {
        $order["field"] = $field;
        if (is_null($direction)) {
            $order["direction"] = "ASC";
        } else {
            $order["direction"] = $direction;
        }
        $this->orders[] = $order;
        return $this;
    }
1363094
public function orderBy($column, $how = 'ASC')
    {
        if (!array_key_exists('order_by', $this->query)) {
            $this->query['order_by'] = array();
        }

        // Multiple?
        if (is_array($column)) {
            foreach ($column as $col => $how) {
                $this->orderBy($col, $how);
            }
        } else {
            $this->query['order_by'][] = $this->columnName($column) . " {$how}";
        }
        return $this;
    }
1205950
public function orderBy(string $key, string $direction = 'ASC'): SelectQueryBuilder
    {
        array_push($this->orderBy, [
            'key' => $key,
            'direction' => strtoupper($direction),
        ]);
        return $this;
    }
77129
public function orderBy($column, $direction = 'ASC')
    {
        $this->ordering[$this->applyTableAlias($column)] = $direction;

        return $this;
    }
1199729
public function orderBy($column, $type = 'asc')
    {
        if (! is_null($this->order)) {
            return $this;
        }

        if (!in_array($type, ['asc', 'desc'])) {
            $type = 'asc';
        }

        $this->order = 'order by `'.$column.'` '.$type;

        return $this;
    }
8414
public function sortBy(string $field, string $direction = 'asc'): self
    {
        $this->sortBy = [$field, $direction];

        return $this;
    }
1279135
public function columns( $column )
    {
        if( is_array($column ) ) {
            $this->columns += $column;
        } elseif( func_num_args() > 1 ) {
            $column = func_get_args();
            $this->columns += $column;
        }
        return $this;
    }
187446
public static function create(array $properties, Direction $direction = null) : Sort
    {
        if ($direction === null) {
            $direction = Direction::$ASC;
        }
        $orders = [];
        foreach ($properties as $property) {
            $orders[] = new Order($direction, $property);
        }
        return new self($orders);
    }
488214
public function orderBy($column, $type = Order::ASC)
    {
        if (null !== $return = $this->validateMethodCall()) {
            return $return;
        }

        $this->orderBy[] = [$column, $type];

        return $this;
    }
402950
public function addColumn(Column $column)
    {
        $this->columns[] = $column;

        if ($column instanceof ColumnInput) {
            $this->append_empty_row = true;
            $this->setWidth('100%');
        } elseif ($column instanceof ColumnOrder && $column->isDragable()) {
            $this->dragable = true;
        } elseif ($column instanceof ColumnTree && !$this->tree) {
            $this->tree_node_id = \count($this->columns) - 1;
            $this->tree = true;
        } elseif ($column instanceof ColumnTree && $this->tree) {
            throw new LogicException('May be only one ColumnTree');
        }

        return $this;
    }
271448
public function addOrder($field, $direction = SORT_ASC) {
		$this->query[self::ORDER][ $field ] = $direction;
		return $this;
	}
185713
protected function getNullsLastSql($column, $direction)
    {
        $sql = $this->config->get('datatables.nulls_last_sql', '%s %s NULLS LAST');

        return sprintf($sql, $column, $direction);
    }