protected function addPathIfNeeded(EloquentNode $node)
    {
        // No path column
        if (!$this->pathKey) {
            return;
        }

        // Path was passed
        if ($node->getAttribute($this->pathKey)) {
            return;
        }

        $segment = $node->getAttribute($this->segmentKey);

        if ($node->isRoot() && $segment) {
            $node->setAttribute($this->pathKey, '/' . $this->cleanSegment($segment));
            return;
        }

        $parent = $this->guessParent($node);

        $parentPath = $parent->getPath();

        $node->setAttribute($this->pathKey, rtrim($parentPath, '/') . '/' . $this->cleanSegment($node->getPathSegment()));

    }
protected function addPathIfNeeded(EloquentNode $node)
    {
        // No path column
        if (!$this->pathKey) {
            return;
        }

        // Path was passed
        if ($node->getAttribute($this->pathKey)) {
            return;
        }

        $segment = $node->getAttribute($this->segmentKey);

        if ($node->isRoot() && $segment) {
            $node->setAttribute($this->pathKey, '/' . $this->cleanSegment($segment));
            return;
        }

        $parent = $this->guessParent($node);

        $parentPath = $parent->getPath();

        $node->setAttribute($this->pathKey, rtrim($parentPath, '/') . '/' . $this->cleanSegment($node->getPathSegment()));

    }
protected function addPathIfNeeded ( EloquentNode $ node ) { // No path column if ( ! $ this -> pathKey ) { return ; } // Path was passed if ( $ node -> getAttribute ( $ this -> pathKey ) ) { return ; } $ segment = $ node -> getAttribute ( $ this -> segmentKey ) ; if ( $ node -> isRoot ( ) && $ segment ) { $ node -> setAttribute ( $ this -> pathKey , '/' . $ this -> cleanSegment ( $ segment ) ) ; return ; } $ parent = $ this -> guessParent ( $ node ) ; $ parentPath = $ parent -> getPath ( ) ; $ node -> setAttribute ( $ this -> pathKey , rtrim ( $ parentPath , '/' ) . '/' . $ this -> cleanSegment ( $ node -> getPathSegment ( ) ) ) ; }
Calculate and add a stored path attribute if a pathKey exists.

@param EloquentNode $node
Calculate and add a stored path attribute if a pathKey exists .