src/Gzero/EloquentTree/Model/Tree.php
public function validateSetChildOf(Tree $parent)
    {
        if ($parent->getKey() == $this->getKey()) {
            throw new SelfConnectionException();
        }
        if ($parent->{$this->getTreeColumn('path')} != $this->removeLastNodeFromPath()) { // Only if new parent
            return true;
        }
        return false;
    }
public function validateSetChildOf(Tree $parent)
    {
        if ($parent->getKey() == $this->getKey()) {
            throw new SelfConnectionException();
        }
        if ($parent->{$this->getTreeColumn('path')} != $this->removeLastNodeFromPath()) { // Only if new parent
            return true;
        }
        return false;
    }
public function validateSetChildOf ( Tree $ parent ) { if ( $ parent -> getKey ( ) == $ this -> getKey ( ) ) { throw new SelfConnectionException ( ) ; } if ( $ parent -> { $ this -> getTreeColumn ( 'path' ) } != $ this -> removeLastNodeFromPath ( ) ) { // Only if new parent return true ; } return false ; }
Validate if parent change and prevent self connection

@param Tree $parent New parent node

@return bool
@throws Exception\SelfConnectionException
Validate if parent change and prevent self connection