| Methods |
public
|
getParentForeignKeyName(): string
Return the name of the "parent_id" column.
Return the name of the "parent_id" column.
|
#
|
public
|
getParentKey(): mixed
Return the value of the "parent_id" column.
Return the value of the "parent_id" column.
|
#
|
public
|
parent(): BelongsTo
Many-to-one relation to the parent node.
Many-to-one relation to the parent node.
|
#
|
public
|
ancestors(): BelongsToManyThroughClosures<static::class, $this, Pivot>
Many-to-many relation to the ancestors through the closure table.
Many-to-many relation to the ancestors through the closure table.
|
#
|
public
|
ascendingClosures(): HasMany<Closure, $this>
One-to-many relationships to the ascending closures.
One-to-many relationships to the ascending closures.
|
#
|
public
|
siblings(): HasManySiblings<$this>
One-to-many relationship to the siblings.
One-to-many relationship to the siblings.
|
#
|
public
|
hasManySiblings(string $parentForeignKey = 'parent_id'): HasManySiblings<$this>
Define a one-to-many relationship through a parent foreign key.
Define a one-to-many relationship through a parent foreign key.
|
#
|
public
|
scopeWithAncestors(Builder $query, int|null $depth = null, callable|null $constraints = null): void
|
#
|
public
|
scopeWithDepth(Builder $query, string $as = 'depth'): void
|
#
|
public
|
scopeWhereIsDescendantOf(Builder $query, mixed|Model $ancestor, int|null $maxDepth = null, bool $withSelf = false): void
|
#
|
public
|
scopeDescendantsOf(Builder $query, mixed|Model $ancestor, int|null $maxDepth = null, bool $withSelf = false): void
|
#
|
public
|
isChildOf(mixed|Model $node): bool
|
#
|
public
|
isDescendantOf(mixed|Model $node): bool
|
#
|
public
|
isSiblingOf(Model $node): bool
|
#
|
public
|
findCommonAncestorWith(mixed|Model $node): Model|null
Returns the closest common ancestor with the provided $node.
May return null if the tree has multiple roots and the 2…
Returns the closest common ancestor with the provided $node.
May return null if the tree has multiple roots and the 2 nodes have no
common ancestor.
|
#
|
public
|
hasCommonAncestorWith(mixed|Model $node): bool
|
#
|
protected
|
newCommonAncestorQuery(mixed|Model $node): BelongsToManyThroughClosures
|
#
|
public
|
getDistanceTo(mixed|Model $node): int
Returns the distance between $this and another $item.
May throw an exception if the tree has multiple roots and the 2…
Returns the distance between $this and another $item.
May throw an exception if the tree has multiple roots and the 2 items
have no common ancestor.
Throws
|
#
|
public
|
getDepth(): int
Return the depth of $this in the tree (0 is $this is a root).
Return the depth of $this in the tree (0 is $this is a root).
|
#
|