protected function setOrder(Select $query, array $order)
    {
        // Normalize to [['column', 'direction']] format if only one column
        if (! is_array(Arr::get($order, 0))) {
            $order = [$order];
        }

        foreach ($order as $key => $orderValue) {
            if (is_array($orderValue)) {
                // Column and direction
                $query->order(
                    Arr::get($orderValue, 0).' '.Arr::get($orderValue, 1)
                );
            }
        }

        return $query;
    }
protected function setOrder(Select $query, array $order)
    {
        // Normalize to [['column', 'direction']] format if only one column
        if (! is_array(Arr::get($order, 0))) {
            $order = [$order];
        }

        foreach ($order as $key => $orderValue) {
            if (is_array($orderValue)) {
                // Column and direction
                $query->order(
                    Arr::get($orderValue, 0).' '.Arr::get($orderValue, 1)
                );
            }
        }

        return $query;
    }
protected function setOrder ( Select $ query , array $ order ) { // Normalize to [['column', 'direction']] format if only one column if ( ! is_array ( Arr :: get ( $ order , 0 ) ) ) { $ order = [ $ order ] ; } foreach ( $ order as $ key => $ orderValue ) { if ( is_array ( $ orderValue ) ) { // Column and direction $ query -> order ( Arr :: get ( $ orderValue , 0 ) . ' ' . Arr :: get ( $ orderValue , 1 ) ) ; } } return $ query ; }
Set the order on the given query

Can specify order as [['column', 'direction'], ['column', 'direction']]
or just ['column', 'direction'] or even [['column', 'direction'], 'column']

@param Select $query
@param array  $order

@return Select
Set the order on the given query