public function scopeOrderModel($query)
    {
        $parentFields = $this->getParentFieldName();
        if ($parentFields) {
            $parentFields = (array) $parentFields;
            foreach ($parentFields as $parentFieldName) {
                $query->where($parentFieldName, $this->{$parentFieldName});
            }
        }

        return $query->orderBy($this->getOrderField(), 'ASC');
    }
public function scopeOrderModel($query)
    {
        $parentFields = $this->getParentFieldName();
        if ($parentFields) {
            $parentFields = (array) $parentFields;
            foreach ($parentFields as $parentFieldName) {
                $query->where($parentFieldName, $this->{$parentFieldName});
            }
        }

        return $query->orderBy($this->getOrderField(), 'ASC');
    }
public function scopeOrderModel ( $ query ) { $ parentFields = $ this -> getParentFieldName ( ) ; if ( $ parentFields ) { $ parentFields = ( array ) $ parentFields ; foreach ( $ parentFields as $ parentFieldName ) { $ query -> where ( $ parentFieldName , $ this -> { $ parentFieldName } ) ; } } return $ query -> orderBy ( $ this -> getOrderField ( ) , 'ASC' ) ; }
Order scope.

@param $query

@return mixed
Order scope .