src/traits/class-orderby.php
public function orderBy( $columns, $direction = 'asc' ) { // @codingStandardsIgnoreLine
		if ( is_string( $columns ) ) {
			$columns = $this->argument_to_array( $columns );
		}

		foreach ( $columns as $key => $column ) {
			if ( is_numeric( $key ) ) {
				$this->statements['orders'][ $column ] = $direction;
			} else {
				$this->statements['orders'][ $key ] = $column;
			}
		}

		return $this;
	}
public function orderBy( $columns, $direction = 'asc' ) { // @codingStandardsIgnoreLine
		if ( is_string( $columns ) ) {
			$columns = $this->argument_to_array( $columns );
		}

		foreach ( $columns as $key => $column ) {
			if ( is_numeric( $key ) ) {
				$this->statements['orders'][ $column ] = $direction;
			} else {
				$this->statements['orders'][ $key ] = $column;
			}
		}

		return $this;
	}
Add an order by statement to the current query

->orderBy('created_at')
->orderBy('modified_at', 'desc')

// multiple order statements
->orderBy(['firstname', 'lastname'], 'desc')

// muliple order statements with diffrent directions
->orderBy(['firstname' => 'asc', 'lastname' => 'desc'])

@param array|string $columns   Columns.
@param string       $direction Direction.

@return self The current query builder.