classes/Models/Base.php
public function scopePositioned($query)
    {
        $query->orderBy($this->getTable().'.position', 'asc');
        if ($this->usesTimestamps()) {
            $query->orderBy($this->getTable().'.created_at', 'desc');
        }
        return $query;
    }
public function scopePositioned($query)
    {
        $query->orderBy($this->getTable().'.position', 'asc');
        if ($this->usesTimestamps()) {
            $query->orderBy($this->getTable().'.created_at', 'desc');
        }
        return $query;
    }
public function scopePositioned ( $ query ) { $ query -> orderBy ( $ this -> getTable ( ) . '.position' , 'asc' ) ; if ( $ this -> usesTimestamps ( ) ) { $ query -> orderBy ( $ this -> getTable ( ) . '.created_at' , 'desc' ) ; } return $ query ; }
Order a table that has a position value

@param  Illuminate\Database\Query\Builder $query
@return Illuminate\Database\Query\Builder
Order a table that has a position value