public function scopeSort(Builder $query, $column, $direction)
    {
        if (!in_array($column, $this->sortable)) {
            return $query;
        }

        return $query->orderBy($column, $direction);
    }
public function scopeSort(Builder $query, $column, $direction)
    {
        if (!in_array($column, $this->sortable)) {
            return $query;
        }

        return $query->orderBy($column, $direction);
    }
public function scopeSort ( Builder $ query , $ column , $ direction ) { if ( ! in_array ( $ column , $ this -> sortable ) ) { return $ query ; } return $ query -> orderBy ( $ column , $ direction ) ; }
Adds a sort scope.

@param \Illuminate\Database\Eloquent\Builder $query
@param string                                $column
@param string                                $direction

@return \Illuminate\Database\Eloquent\Builder
Adds a sort scope .