public function rankSwitch($to)
    {
        $owner = $this->owner;
        $this->getSiblings()->andWhere([$this->attribute => $to])->one()->updateAttributes([
            $this->attribute => $this->owner->getAttribute($this->attribute)
        ]);
        $owner->updateAttributes([$this->attribute => $to]);
    }
public function rankSwitch($to)
    {
        $owner = $this->owner;
        $this->getSiblings()->andWhere([$this->attribute => $to])->one()->updateAttributes([
            $this->attribute => $this->owner->getAttribute($this->attribute)
        ]);
        $owner->updateAttributes([$this->attribute => $to]);
    }
public function rankSwitch ( $ to ) { $ owner = $ this -> owner ; $ this -> getSiblings ( ) -> andWhere ( [ $ this -> attribute => $ to ] ) -> one ( ) -> updateAttributes ( [ $ this -> attribute => $ this -> owner -> getAttribute ( $ this -> attribute ) ] ) ; $ owner -> updateAttributes ( [ $ this -> attribute => $ to ] ) ; }
Switches rank position with another model.
@param integer $to another model current rank position.
Switches rank position with another model .