src/Handler.php
protected function parseSort($params)
    {
        foreach (explode(',', $params) as $sort) {
            // Check if ascending or descending(-) sort
            if (preg_match('/^-.+/', $sort)) {
                $direction = 'desc';
            } else {
                $direction = 'asc';
            }

            $sort = preg_replace('/^-/', '', $sort);
            if (! $this->canSort($sort)) {
                return;
            }

            // Only add the sorts that are on the base resource
            if (! Str::contains($sort, '.')) {
                $this->getHandler()->orderBy($sort, $direction);
            } else {
                $this->additionalSorts[$sort] = $direction;
            }
        }
    }
protected function parseSort($params)
    {
        foreach (explode(',', $params) as $sort) {
            // Check if ascending or descending(-) sort
            if (preg_match('/^-.+/', $sort)) {
                $direction = 'desc';
            } else {
                $direction = 'asc';
            }

            $sort = preg_replace('/^-/', '', $sort);
            if (! $this->canSort($sort)) {
                return;
            }

            // Only add the sorts that are on the base resource
            if (! Str::contains($sort, '.')) {
                $this->getHandler()->orderBy($sort, $direction);
            } else {
                $this->additionalSorts[$sort] = $direction;
            }
        }
    }
protected function parseSort ( $ params ) { foreach ( explode ( ',' , $ params ) as $ sort ) { // Check if ascending or descending(-) sort if ( preg_match ( '/^-.+/' , $ sort ) ) { $ direction = 'desc' ; } else { $ direction = 'asc' ; } $ sort = preg_replace ( '/^-/' , '' , $ sort ) ; if ( ! $ this -> canSort ( $ sort ) ) { return ; } // Only add the sorts that are on the base resource if ( ! Str :: contains ( $ sort , '.' ) ) { $ this -> getHandler ( ) -> orderBy ( $ sort , $ direction ) ; } else { $ this -> additionalSorts [ $ sort ] = $ direction ; } } }
Parse the sort parameter.

@param  string $params
@return void
Parse the sort parameter .