trait HasNode

Traits

Properties

protected array $pending

Pending operations.

protected bool $moved

Whether the node has moved since last save.

protected bool $cascadingAsDescendant

Whether the node is being deleted or restored by an ancestor's evented cascade.

null|int|string $parent_id
?int $depth
?static $parent

Methods

static Builder
query()

Begin querying the model.

newEloquentBuilder(Builder $query)

Create a new Eloquent query builder for the model.

newQuery()

Get a new query builder for the model's table.

newModelQuery()

Get a new query builder that doesn't have any global scopes or eager loading.

newQueryWithoutRelationships()

Get a new query builder with no relationships loaded.

newQueryWithoutScopes()

Get a new query builder that doesn't have any global scopes.

newQueryWithoutScope(Scope|int|string $scope)

Get a new query instance without a given scope.

newQueryForRestoration(array|int|string $ids)

Get a new query to restore one or more models by their queueable IDs.

static Builder
on(UnitEnum|string|null $connection = null)

Begin querying the model on a given connection.

static Builder
onWriteConnection()

Begin querying the model on the write connection.

static Builder
with(array|string $relations)

Begin querying a model with eager loading.

mixed
fireModelEvent(string $event, bool $halt = true)

Fire the given event for the model, keeping the tree consistent around its observers.

setNodeAction(string $action, mixed ...$args)

Set an action.

void
callPendingAction()

Call pending action.

bool
save(array $options = [])

Save the model to the database.

bool
saveOrIgnore(array $options = [], array|string|null $uniqueBy = null)

Save the model to the database, ignoring specific unique constraint conflicts.

bool
restorePendingActionUnlessSaved(Closure $save)

Run a save, restoring its consumed action when the save does not complete.

static bool
usesSoftDelete()

Determine whether the model uses soft deletes.

bool
actionRaw()

Apply a raw node action.

bool
actionAppendToParentId(int|string $parentId)

Resolve the deferred parent and append the node to it.

bool
actionRoot()

Make a root node.

bool
actionSaveAsRoot()

Save the node as a root without moving an existing root.

int
getLowerBound()

Get the lower bound.

bool
actionAppendOrPrepend(HasNode $parent, bool $prepend = false)

Append or prepend a node to the parent.

bool
actionAppendOrPrependPrepared(HasNode $parent, bool $prepend = false)

Append or prepend using a parent already read from the write connection.

setParent(Model|null $value)

Apply parent model.

setParentFromSibling(HasNode $node)

Apply the current parent of a sibling without resolving its relation.

bool
actionBeforeOrAfter(HasNode $node, bool $after = false)

Insert node before or after another node.

void
refreshNode()

Refresh node's crucial attributes.

void
prepareForNestedSetMutation(array $extraColumns = [])

Prepare a model to participate in a structural mutation.

void
prepareFromPersistedAttributes(array $persisted)

Prepare an existing model for a structural mutation from its persisted row.

void
applyPersistedNodeAttributes(array $attributes)

Apply an authoritative structural snapshot to this model.

array
getPersistedNodeAttributes(array $columns)

Read selected attributes from the exact persisted row.

array|null
findPersistedNodeAttributes(array $columns)

Read selected attributes from the exact persisted row, if it still exists.

array
getStructuralColumns()

Get the columns that define structural position.

array
getMutationIdentityColumns()

Get the columns that identify one mutable tree row.

parent()

Relation to the parent.

children()

Relation to children.

descendants()

Get query for descendants of the node.

siblings()

Get query for siblings of the node.

siblingsAndSelf()

Get the relation for the node siblings and the node itself.

getSiblingsAndSelf(array $columns = ['*'])

Get the node siblings and the node itself.

nextSiblings()

Get query for siblings after the node.

prevSiblings()

Get query for siblings before the node.

nextNodes()

Get query for nodes after current node.

prevNodes()

Get query for nodes before current node.

ancestors()

Get query ancestors of the node.

makeRoot()

Make this node a root node.

bool
saveAsRoot()

Save node as root.

bool
appendNode(HasNode $node)

Append and save a node.

bool
prependNode(HasNode $node)

Prepend and save a node.

appendToNode(HasNode $parent)

Append a node to the new parent.

prependToNode(HasNode $parent)

Prepend a node to the new parent.

appendOrPrependTo(HasNode $parent, bool $prepend = false)

Prepare the node for insertion as a child.

afterNode(HasNode $node)

Insert self after a node.

beforeNode(HasNode $node)

Insert self before node.

beforeOrAfterNode(HasNode $node, bool $after = false)

Prepare the node for insertion beside another node.

bool
insertAfterNode(HasNode $node)

Insert self after a node and save.

bool
insertBeforeNode(HasNode $node)

Insert self before a node and save.

rawNode(int $lft, int $rgt, int|string|null $parentId, int|null $depth)

Set raw structural values.

bool
up(int $amount = 1)

Move node up given amount of positions.

bool
down(int $amount = 1)

Move node down given amount of positions.

bool
insertAt(int $position, int|null $targetDepth = null)

Insert node at specific position.

bool
moveNode(int $position, int|null $targetDepth = null)

Move a node to the new position.

bool
insertNode(int $position, int|null $targetDepth = null)

Insert new node at specified position.

void
deleteDescendants()

Delete the node's descendants, including any hidden by ordinary global scopes.

bool
shouldFireDescendantEvents()

Determine whether descendant model events should be fired during deletion and restoration.

int
getDescendantChunkSize()

Get the number of descendants loaded per evented deletion or restoration chunk.

void
deleteDescendantsWithEvents(bool $forceDelete)

Delete descendants through their model lifecycle in children-first chunks.

void
changeDescendantsWithEvents(QueryBuilder $query, bool $childrenFirst, string $operation, Closure $change)

Change descendants one at a time in bounded chunks ordered by their left bound.

void
restoreDescendants(DateTimeInterface|int|string $deletedAt)

Restore descendants deleted at or after the given stored deletion time.

newNestedSetQuery(string|null $table = null)

Get a new base query that includes deleted nodes.

newScopedQuery(string|null $table = null)

Get a new query with ordinary visibility and the concrete tree scope.

applyNestedSetScope(Builder|Builder $query, string|null $table = null)

Apply the concrete tree scope to the query.

array
getScopeAttributes()

Get the attributes that partition nested set trees.

bool
hasCompleteNestedSetScope()

Determine whether every configured scope attribute is loaded.

void
ensureNestedSetScopeIsUnchanged(array|null $persisted = null)

Ensure an existing model has not changed tree scope.

void
ensureConcreteNestedSetScope(string $operation)

Ensure a model selects one concrete nested set scope.

array
getNestedSetScope()

Get the normalized scope values for this tree.

int|string|null
normalizeNestedSetScopeValue(string $attribute, mixed $value)

Normalize a nested set scope value for SQL and identity comparisons.

string
getNestedSetScopeKey()

Get the stable identity key for this tree scope.

static QueryBuilder
scoped(array $attributes)

Begin a query for one concrete nested set scope.

newCollection(array $models = [])

Create a new nested set collection.

static HasNode
create(array $attributes = [], HasNode|null $parent = null)

Use children key on $attributes to create child nodes.

int
getNodeHeight()

Get node height (rgt - lft + 1).

int
getDescendantCount()

Get number of descendant nodes.

setParentIdAttribute(int|string|null $value)

Set the value of model's parent id key.

bool
isRoot()

Get whether node is root.

bool
isLeaf()

Determine whether the node is a leaf.

string
getLftName()

Get the lft key name.

string
getRgtName()

Get the rgt key name.

string
getParentIdName()

Get the parent id key name.

string
getDepthName()

Get the depth column name.

int|null
getLft()

Get the value of the model's lft key.

int|null
getRgt()

Get the value of the model's rgt key.

int|string|null
getParentId()

Get the value of the model's parent id key.

int|null
getDepth()

Get the node depth.

Model|null
getNextNode(array $columns = ['*'])

Return the node that is next to the current node without constraining to siblings.

Model|null
getPrevNode(array $columns = ['*'])

Return the node that is before the current node without constraining to siblings.

getAncestors(array $columns = ['*'])

Get the node's ancestors.

getDescendants(array $columns = ['*'])

Get the node's descendants.

getSiblings(array $columns = ['*'])

Get the node's siblings.

getNextSiblings(array $columns = ['*'])

Get siblings after the node.

getPrevSiblings(array $columns = ['*'])

Get siblings before the node.

Model|null
getNextSibling(array $columns = ['*'])

Get the next sibling.

Model|null
getPrevSibling(array $columns = ['*'])

Get the previous sibling.

bool
isDescendantOf(HasNode $other)

Get whether a node is a descendant of other node.

bool
isSelfOrDescendantOf(HasNode $other)

Get whether a node is itself or a descendant of other node.

bool
isChildOf(HasNode $other)

Get whether the node is immediate children of other node.

bool
isSiblingOf(HasNode $other)

Get whether the node is a sibling of another node.

bool
isAncestorOf(HasNode $other)

Get whether the node is an ancestor of other node, including immediate parent.

bool
isSelfOrAncestorOf(HasNode $other)

Get whether the node is itself or an ancestor of other node, including immediate parent.

bool
hasMoved()

Get whether the node has moved since last save.

bool
hardDeleting()

Get whether user is intended to delete the model from database entirely.

array
getBounds()

Get the node bounds.

setLft(int|null $value)

Set the left bound.

setRgt(int|null $value)

Set the right bound.

setParentId(int|string|null $value)

Set the parent key.

setDepth(int|null $value)

Set the node depth.

dirtyBounds()

Mark the stored bounds as dirty.

void
unsetNestedSetRelations()

Forget relations derived from the node's structural position.

void
ensureLoadedStructuralTargetIsValid(HasNode $node)

Reject structural targets that are already known to be unusable.

assertNotDescendant(HasNode $node)

Assert that a node is neither this node nor one of its descendants.

assertNodeExists(HasNode $node)

Assert that a node has positive tree bounds.

void
ensureBoundsLoaded()

Ensure that this node has loaded bounds.

void
ensureParentageLoaded()

Ensure that this node has loaded parentage.

void
ensureScopeLoaded()

Ensure that this node has loaded scope attributes.

ensureSameTree(HasNode $node)

Ensure that a node belongs to the same nested set tree.

bool
isSameScope(HasNode $node)

Determine whether a node belongs to the same concrete scope.

bool
isSameTree(HasNode $node)

Determine whether the models address the same nested set tree.

bool
isSameNode(HasNode $node)

Determine whether the models address the same persisted row.

replicate(array|null $except = null)

Clone the node without structural attributes.

Details

in HasBuilder at line 20
static Builder query()

Begin querying the model.

Return Value

Builder

at line 57
QueryBuilder newEloquentBuilder(Builder $query)

Create a new Eloquent query builder for the model.

Parameters

Builder $query

Return Value

QueryBuilder

in HasBuilder at line 40
Builder newQuery()

Get a new query builder for the model's table.

Return Value

Builder

in HasBuilder at line 50
Builder newModelQuery()

Get a new query builder that doesn't have any global scopes or eager loading.

Return Value

Builder

in HasBuilder at line 60
Builder newQueryWithoutRelationships()

Get a new query builder with no relationships loaded.

Return Value

Builder

in HasBuilder at line 70
Builder newQueryWithoutScopes()

Get a new query builder that doesn't have any global scopes.

Return Value

Builder

in HasBuilder at line 80
Builder newQueryWithoutScope(Scope|int|string $scope)

Get a new query instance without a given scope.

Parameters

Scope|int|string $scope

Return Value

Builder

in HasBuilder at line 90
Builder newQueryForRestoration(array|int|string $ids)

Get a new query to restore one or more models by their queueable IDs.

Parameters

array|int|string $ids

Return Value

Builder

in HasBuilder at line 100
static Builder on(UnitEnum|string|null $connection = null)

Begin querying the model on a given connection.

Parameters

UnitEnum|string|null $connection

Return Value

Builder

in HasBuilder at line 110
static Builder onWriteConnection()

Begin querying the model on the write connection.

Return Value

Builder

in HasBuilder at line 120
static Builder with(array|string $relations)

Begin querying a model with eager loading.

Parameters

array|string $relations

Return Value

Builder

at line 89
protected mixed fireModelEvent(string $event, bool $halt = true)

Fire the given event for the model, keeping the tree consistent around its observers.

Upstream maintains the tree from listeners registered in bootNodeTrait(). A custom $dispatchesEvents result skips those listeners, and listeners cannot act after every deleting observer has allowed a delete, so the maintenance runs here instead.

Parameters

string $event
bool $halt

Return Value

mixed

at line 157
protected HasNode setNodeAction(string $action, mixed ...$args)

Set an action.

Parameters

string $action
mixed ...$args

Return Value

HasNode

at line 167
protected void callPendingAction()

Call pending action.

Return Value

void

at line 201
bool save(array $options = [])

Save the model to the database.

Parameters

array $options

Return Value

bool

at line 209
bool saveOrIgnore(array $options = [], array|string|null $uniqueBy = null)

Save the model to the database, ignoring specific unique constraint conflicts.

Parameters

array $options
array|string|null $uniqueBy

Return Value

bool

at line 217
protected bool restorePendingActionUnlessSaved(Closure $save)

Run a save, restoring its consumed action when the save does not complete.

Parameters

Closure $save

Return Value

bool

at line 236
static bool usesSoftDelete()

Determine whether the model uses soft deletes.

Return Value

bool

at line 244
protected bool actionRaw()

Apply a raw node action.

Return Value

bool

at line 252
protected bool actionAppendToParentId(int|string $parentId)

Resolve the deferred parent and append the node to it.

Parameters

int|string $parentId

Return Value

bool

at line 268
protected bool actionRoot()

Make a root node.

Return Value

bool

at line 289
protected bool actionSaveAsRoot()

Save the node as a root without moving an existing root.

Return Value

bool

at line 299
protected int getLowerBound()

Get the lower bound.

Return Value

int

at line 309
protected bool actionAppendOrPrepend(HasNode $parent, bool $prepend = false)

Append or prepend a node to the parent.

Parameters

HasNode $parent
bool $prepend

Return Value

bool

at line 319
protected bool actionAppendOrPrependPrepared(HasNode $parent, bool $prepend = false)

Append or prepend using a parent already read from the write connection.

Parameters

HasNode $parent
bool $prepend

Return Value

bool

at line 343
protected HasNode setParent(Model|null $value)

Apply parent model.

Parameters

Model|null $value

Return Value

HasNode

at line 354
protected HasNode setParentFromSibling(HasNode $node)

Apply the current parent of a sibling without resolving its relation.

Parameters

HasNode $node

Return Value

HasNode

at line 371
protected bool actionBeforeOrAfter(HasNode $node, bool $after = false)

Insert node before or after another node.

Parameters

HasNode $node
bool $after

Return Value

bool

at line 390
void refreshNode()

Refresh node's crucial attributes.

Return Value

void

at line 404
void prepareForNestedSetMutation(array $extraColumns = [])

Prepare a model to participate in a structural mutation.

Parameters

array $extraColumns

Return Value

void

at line 424
protected void prepareFromPersistedAttributes(array $persisted)

Prepare an existing model for a structural mutation from its persisted row.

Parameters

array $persisted

Return Value

void

at line 434
protected void applyPersistedNodeAttributes(array $attributes)

Apply an authoritative structural snapshot to this model.

Parameters

array $attributes

Return Value

void

at line 444
protected array getPersistedNodeAttributes(array $columns)

Read selected attributes from the exact persisted row.

Parameters

array $columns

Return Value

array

at line 453
protected array|null findPersistedNodeAttributes(array $columns)

Read selected attributes from the exact persisted row, if it still exists.

Parameters

array $columns

Return Value

array|null

at line 478
protected array getStructuralColumns()

Get the columns that define structural position.

Return Value

array

at line 492
protected array getMutationIdentityColumns()

Get the columns that identify one mutable tree row.

Return Value

array

at line 506
BelongsTo parent()

Relation to the parent.

Return Value

BelongsTo

at line 517
HasMany children()

Relation to children.

Return Value

HasMany

at line 528
DescendantsRelation descendants()

Get query for descendants of the node.

Return Value

DescendantsRelation

at line 538
SiblingsRelation siblings()

Get query for siblings of the node.

Return Value

SiblingsRelation

at line 548
SiblingsRelation siblingsAndSelf()

Get the relation for the node siblings and the node itself.

Return Value

SiblingsRelation

at line 558
Collection getSiblingsAndSelf(array $columns = ['*'])

Get the node siblings and the node itself.

Parameters

array $columns

Return Value

Collection

at line 568
QueryBuilder nextSiblings()

Get query for siblings after the node.

Return Value

QueryBuilder

at line 585
QueryBuilder prevSiblings()

Get query for siblings before the node.

Return Value

QueryBuilder

at line 602
QueryBuilder nextNodes()

Get query for nodes after current node.

Return Value

QueryBuilder

at line 620
QueryBuilder prevNodes()

Get query for nodes before current node.

Return Value

QueryBuilder

at line 638
AncestorsRelation ancestors()

Get query ancestors of the node.

Return Value

AncestorsRelation

at line 646
HasNode makeRoot()

Make this node a root node.

Return Value

HasNode

at line 656
bool saveAsRoot()

Save node as root.

Return Value

bool

at line 664
bool appendNode(HasNode $node)

Append and save a node.

Parameters

HasNode $node

Return Value

bool

at line 672
bool prependNode(HasNode $node)

Prepend and save a node.

Parameters

HasNode $node

Return Value

bool

at line 680
HasNode appendToNode(HasNode $parent)

Append a node to the new parent.

Parameters

HasNode $parent

Return Value

HasNode

at line 688
HasNode prependToNode(HasNode $parent)

Prepend a node to the new parent.

Parameters

HasNode $parent

Return Value

HasNode

at line 696
HasNode appendOrPrependTo(HasNode $parent, bool $prepend = false)

Prepare the node for insertion as a child.

Parameters

HasNode $parent
bool $prepend

Return Value

HasNode

at line 712
HasNode afterNode(HasNode $node)

Insert self after a node.

Parameters

HasNode $node

Return Value

HasNode

at line 720
HasNode beforeNode(HasNode $node)

Insert self before node.

Parameters

HasNode $node

Return Value

HasNode

at line 728
HasNode beforeOrAfterNode(HasNode $node, bool $after = false)

Prepare the node for insertion beside another node.

Parameters

HasNode $node
bool $after

Return Value

HasNode

at line 744
bool insertAfterNode(HasNode $node)

Insert self after a node and save.

Parameters

HasNode $node

Return Value

bool

at line 758
bool insertBeforeNode(HasNode $node)

Insert self before a node and save.

Parameters

HasNode $node

Return Value

bool

at line 773
HasNode rawNode(int $lft, int $rgt, int|string|null $parentId, int|null $depth)

Set raw structural values.

Parameters

int $lft
int $rgt
int|string|null $parentId
int|null $depth

Return Value

HasNode

at line 790
bool up(int $amount = 1)

Move node up given amount of positions.

Parameters

int $amount

Return Value

bool

at line 814
bool down(int $amount = 1)

Move node down given amount of positions.

Parameters

int $amount

Return Value

bool

at line 838
protected bool insertAt(int $position, int|null $targetDepth = null)

Insert node at specific position.

Parameters

int $position
int|null $targetDepth

Return Value

bool

at line 848
protected bool moveNode(int $position, int|null $targetDepth = null)

Move a node to the new position.

Parameters

int $position
int|null $targetDepth

Return Value

bool

at line 897
protected bool insertNode(int $position, int|null $targetDepth = null)

Insert new node at specified position.

Parameters

int $position
int|null $targetDepth

Return Value

bool

at line 919
protected void deleteDescendants()

Delete the node's descendants, including any hidden by ordinary global scopes.

Hard deletes run before the node's own row is deleted and soft deletes after it, so descendants are never trashed before the node.

Return Value

void

at line 940
protected bool shouldFireDescendantEvents()

Determine whether descendant model events should be fired during deletion and restoration.

Return Value

bool

at line 948
protected int getDescendantChunkSize()

Get the number of descendants loaded per evented deletion or restoration chunk.

Return Value

int

at line 956
protected void deleteDescendantsWithEvents(bool $forceDelete)

Delete descendants through their model lifecycle in children-first chunks.

Parameters

bool $forceDelete

Return Value

void

at line 979
protected void changeDescendantsWithEvents(QueryBuilder $query, bool $childrenFirst, string $operation, Closure $change)

Change descendants one at a time in bounded chunks ordered by their left bound.

Parameters

QueryBuilder $query
bool $childrenFirst
string $operation
Closure $change

Return Value

void

at line 1023
protected void restoreDescendants(DateTimeInterface|int|string $deletedAt)

Restore descendants deleted at or after the given stored deletion time.

Parameters

DateTimeInterface|int|string $deletedAt

Return Value

void

at line 1048
QueryBuilder newNestedSetQuery(string|null $table = null)

Get a new base query that includes deleted nodes.

Parameters

string|null $table

Return Value

QueryBuilder

at line 1060
QueryBuilder newScopedQuery(string|null $table = null)

Get a new query with ordinary visibility and the concrete tree scope.

Parameters

string|null $table

Return Value

QueryBuilder

at line 1073
Builder|Builder applyNestedSetScope(Builder|Builder $query, string|null $table = null)

Apply the concrete tree scope to the query.

Parameters

Builder|Builder $query
string|null $table

Return Value

Builder|Builder

at line 1101
protected array getScopeAttributes()

Get the attributes that partition nested set trees.

Return Value

array

at line 1109
bool hasCompleteNestedSetScope()

Determine whether every configured scope attribute is loaded.

Return Value

bool

at line 1123
protected void ensureNestedSetScopeIsUnchanged(array|null $persisted = null)

Ensure an existing model has not changed tree scope.

Parameters

array|null $persisted

Return Value

void

at line 1167
protected void ensureConcreteNestedSetScope(string $operation)

Ensure a model selects one concrete nested set scope.

Parameters

string $operation

Return Value

void

at line 1186
array getNestedSetScope()

Get the normalized scope values for this tree.

Return Value

array

at line 1203
protected int|string|null normalizeNestedSetScopeValue(string $attribute, mixed $value)

Normalize a nested set scope value for SQL and identity comparisons.

Parameters

string $attribute
mixed $value

Return Value

int|string|null

at line 1224
string getNestedSetScopeKey()

Get the stable identity key for this tree scope.

Return Value

string

at line 1246
static QueryBuilder scoped(array $attributes)

Begin a query for one concrete nested set scope.

Parameters

array $attributes

Return Value

QueryBuilder

at line 1261
Collection newCollection(array $models = [])

Create a new nested set collection.

Parameters

array $models

Return Value

Collection

at line 1269
static HasNode create(array $attributes = [], HasNode|null $parent = null)

Use children key on $attributes to create child nodes.

Parameters

array $attributes
HasNode|null $parent

Return Value

HasNode

at line 1305
int getNodeHeight()

Get node height (rgt - lft + 1).

Return Value

int

at line 1319
int getDescendantCount()

Get number of descendant nodes.

Return Value

int

at line 1328
HasNode setParentIdAttribute(int|string|null $value)

Set the value of model's parent id key.

Behind the scenes node is appended to found parent node.

Parameters

int|string|null $value

Return Value

HasNode

at line 1354
bool isRoot()

Get whether node is root.

Return Value

bool

at line 1363
bool isLeaf()

Determine whether the node is a leaf.

Return Value

bool

at line 1374
string getLftName()

Get the lft key name.

Return Value

string

at line 1382
string getRgtName()

Get the rgt key name.

Return Value

string

at line 1390
string getParentIdName()

Get the parent id key name.

Return Value

string

at line 1398
string getDepthName()

Get the depth column name.

Return Value

string

at line 1406
int|null getLft()

Get the value of the model's lft key.

Return Value

int|null

at line 1416
int|null getRgt()

Get the value of the model's rgt key.

Return Value

int|null

at line 1426
int|string|null getParentId()

Get the value of the model's parent id key.

Return Value

int|string|null

at line 1434
int|null getDepth()

Get the node depth.

Return Value

int|null

at line 1447
Model|null getNextNode(array $columns = ['*'])

Return the node that is next to the current node without constraining to siblings.

This can be either a next sibling or a next sibling of the parent node.

Parameters

array $columns

Return Value

Model|null

at line 1458
Model|null getPrevNode(array $columns = ['*'])

Return the node that is before the current node without constraining to siblings.

This can be either a prev sibling or parent node.

Parameters

array $columns

Return Value

Model|null

at line 1468
Collection getAncestors(array $columns = ['*'])

Get the node's ancestors.

Parameters

array $columns

Return Value

Collection

at line 1478
Collection getDescendants(array $columns = ['*'])

Get the node's descendants.

Parameters

array $columns

Return Value

Collection

at line 1488
Collection getSiblings(array $columns = ['*'])

Get the node's siblings.

Parameters

array $columns

Return Value

Collection

at line 1498
Collection getNextSiblings(array $columns = ['*'])

Get siblings after the node.

Parameters

array $columns

Return Value

Collection

at line 1508
Collection getPrevSiblings(array $columns = ['*'])

Get siblings before the node.

Parameters

array $columns

Return Value

Collection

at line 1518
Model|null getNextSibling(array $columns = ['*'])

Get the next sibling.

Parameters

array $columns

Return Value

Model|null

at line 1528
Model|null getPrevSibling(array $columns = ['*'])

Get the previous sibling.

Parameters

array $columns

Return Value

Model|null

at line 1536
bool isDescendantOf(HasNode $other)

Get whether a node is a descendant of other node.

Parameters

HasNode $other

Return Value

bool

at line 1556
bool isSelfOrDescendantOf(HasNode $other)

Get whether a node is itself or a descendant of other node.

Parameters

HasNode $other

Return Value

bool

at line 1580
bool isChildOf(HasNode $other)

Get whether the node is immediate children of other node.

Parameters

HasNode $other

Return Value

bool

at line 1596
bool isSiblingOf(HasNode $other)

Get whether the node is a sibling of another node.

Parameters

HasNode $other

Return Value

bool

at line 1619
bool isAncestorOf(HasNode $other)

Get whether the node is an ancestor of other node, including immediate parent.

Parameters

HasNode $other

Return Value

bool

at line 1627
bool isSelfOrAncestorOf(HasNode $other)

Get whether the node is itself or an ancestor of other node, including immediate parent.

Parameters

HasNode $other

Return Value

bool

at line 1635
bool hasMoved()

Get whether the node has moved since last save.

Return Value

bool

at line 1643
protected bool hardDeleting()

Get whether user is intended to delete the model from database entirely.

Return Value

bool

at line 1653
array getBounds()

Get the node bounds.

Return Value

array

at line 1661
HasNode setLft(int|null $value)

Set the left bound.

Parameters

int|null $value

Return Value

HasNode

at line 1671
HasNode setRgt(int|null $value)

Set the right bound.

Parameters

int|null $value

Return Value

HasNode

at line 1681
HasNode setParentId(int|string|null $value)

Set the parent key.

Parameters

int|string|null $value

Return Value

HasNode

at line 1692
HasNode setDepth(int|null $value)

Set the node depth.

Parameters

int|null $value

Return Value

HasNode

at line 1702
protected HasNode dirtyBounds()

Mark the stored bounds as dirty.

Return Value

HasNode

at line 1713
protected void unsetNestedSetRelations()

Forget relations derived from the node's structural position.

Return Value

void

at line 1733
protected void ensureLoadedStructuralTargetIsValid(HasNode $node)

Reject structural targets that are already known to be unusable.

Partial models are deliberately allowed here. The save boundary reloads every participant from the write connection before changing the tree.

Parameters

HasNode $node

Return Value

void

at line 1760
protected HasNode assertNotDescendant(HasNode $node)

Assert that a node is neither this node nor one of its descendants.

Parameters

HasNode $node

Return Value

HasNode

at line 1772
protected HasNode assertNodeExists(HasNode $node)

Assert that a node has positive tree bounds.

Parameters

HasNode $node

Return Value

HasNode

at line 1784
protected void ensureBoundsLoaded()

Ensure that this node has loaded bounds.

Return Value

void

at line 1797
protected void ensureParentageLoaded()

Ensure that this node has loaded parentage.

Return Value

void

at line 1810
protected void ensureScopeLoaded()

Ensure that this node has loaded scope attributes.

Return Value

void

at line 1826
protected HasNode ensureSameTree(HasNode $node)

Ensure that a node belongs to the same nested set tree.

Parameters

HasNode $node

Return Value

HasNode

at line 1838
protected bool isSameScope(HasNode $node)

Determine whether a node belongs to the same concrete scope.

Parameters

HasNode $node

Return Value

bool

at line 1848
protected bool isSameTree(HasNode $node)

Determine whether the models address the same nested set tree.

Parameters

HasNode $node

Return Value

bool

at line 1857
protected bool isSameNode(HasNode $node)

Determine whether the models address the same persisted row.

Parameters

HasNode $node

Return Value

bool

at line 1877
HasNode replicate(array|null $except = null)

Clone the node without structural attributes.

Parameters

array|null $except

Return Value

HasNode