protected function sort($builder)
    {
        if (count($builder->orders) == 0) {
            return null;
        }

        return collect($builder->orders)->map(function($order) {
            return [$order['column'] => $order['direction']];
        })->toArray();
    }
protected function sort($builder)
    {
        if (count($builder->orders) == 0) {
            return null;
        }

        return collect($builder->orders)->map(function($order) {
            return [$order['column'] => $order['direction']];
        })->toArray();
    }
protected function sort ( $ builder ) { if ( count ( $ builder -> orders ) == 0 ) { return null ; } return collect ( $ builder -> orders ) -> map ( function ( $ order ) { return [ $ order [ 'column' ] => $ order [ 'direction' ] ] ; } ) -> toArray ( ) ; }
Generates the sort if theres any.

@param  Builder $builder
@return array|null
Generates the sort if theres any .