public function scopeSort($query)
    {
        if (!$this->sorters) {

            $message = 'Please set the $sorters property.';
            throw new FilterableSortableException($message);
        }

        $this->sorters = app()->make($this->sorters);

        if (!$this->sorters instanceof QuerySorters) {

            $message = '$sorters property must be a class instance of QuerySorter.';
            throw new FilterableSortableException($message);
        }

        return $this->sorters->apply($query);
    }
public function scopeSort($query)
    {
        if (!$this->sorters) {

            $message = 'Please set the $sorters property.';
            throw new FilterableSortableException($message);
        }

        $this->sorters = app()->make($this->sorters);

        if (!$this->sorters instanceof QuerySorters) {

            $message = '$sorters property must be a class instance of QuerySorter.';
            throw new FilterableSortableException($message);
        }

        return $this->sorters->apply($query);
    }
public function scopeSort ( $ query ) { if ( ! $ this -> sorters ) { $ message = 'Please set the $sorters property.' ; throw new FilterableSortableException ( $ message ) ; } $ this -> sorters = app ( ) -> make ( $ this -> sorters ) ; if ( ! $ this -> sorters instanceof QuerySorters ) { $ message = '$sorters property must be a class instance of QuerySorter.' ; throw new FilterableSortableException ( $ message ) ; } return $ this -> sorters -> apply ( $ query ) ; }
Sort a result set.

@param Builder $query The builder instance.

@return Builder

@throws FilterableSortableException
Sort a result set .