src/Gzero/EloquentTree/Model/Tree.php
public function findRoot()
    {
        if ($this->isRoot()) {
            return $this;
        } else {
            $extractedPath = $this->extractPath();
            $root_id       = array_shift($extractedPath);
            return static::where($this->getKeyName(), '=', $root_id)->first();
        }
    }
public function findRoot()
    {
        if ($this->isRoot()) {
            return $this;
        } else {
            $extractedPath = $this->extractPath();
            $root_id       = array_shift($extractedPath);
            return static::where($this->getKeyName(), '=', $root_id)->first();
        }
    }
public function findRoot ( ) { if ( $ this -> isRoot ( ) ) { return $ this ; } else { $ extractedPath = $ this -> extractPath ( ) ; $ root_id = array_shift ( $ extractedPath ) ; return static :: where ( $ this -> getKeyName ( ) , '=' , $ root_id ) -> first ( ) ; } }
Find root for this node

@return $this
Find root for this node