Builder
class Builder extends Builder
Properties
protected NestedTree|Model | $model |
Methods
Get an array with the values of a given column.
Get an array with the values of a given column.
Perform a search on this query for term found in columns.
Add an "or search where" clause to the query.
Convenient method for where like clause
Convenient method for or where like clause
Internal method to apply a search constraint to the query.
Get an array with the values of dates.
Paginate the given query.
Paginate the given query into a simple paginator.
Find a model by its primary key or return fresh model instance with filled attributes to use with forms.
Get node's lft
and rgt
values.
Get plain node data.
Scope limits query to select just root node.
Limit results to ancestors of specified node.
No description
No description
Get ancestors of specified node.
No description
Add node selection statement between specified range.
Add node selection statement between specified range joined with or
operator.
Add constraint statement to descendants of specified node.
No description
No description
No description
No description
Get descendants of specified node.
No description
No description
Constraint nodes to those that are after specified node.
Constraint nodes to those that are before specified node.
No description
Include depth level into the result.
Get wrapped lft
and rgt
column names.
Get a wrapped table name.
Wrap model's key name.
Exclude root node from the result.
Order by node position.
Order by reversed node position.
Move a node to the new position.
Make or remove gap in the tree. Negative height will remove gap.
Get patch for columns.
Get patch for single column.
Get statistics of errors of the tree.
No description
No description
No description
No description
Get the number of total errors of the tree.
Get whether the tree is broken.
Fixes the tree based on parentage info.
No description
No description
Rebuild the tree based on raw data.
No description
No description
Details
in
Builder at line 22
Collection
lists(string $column, string|null $key = null)
Get an array with the values of a given column.
in
Builder at line 35
Collection
dropdown(string $column, string|null $key = null)
Get an array with the values of a given column.
in
Builder at line 51
Builder
search(string $term, array $columns = [], string $mode = 'all')
Perform a search on this query for term found in columns.
in
Builder at line 65
Builder
orSearch(string $term, array $columns = [], string $mode = 'all')
Add an "or search where" clause to the query.
in
Builder at line 80
Builder
like(string $column, $value, string $side = 'both', string $boolean = 'and')
Convenient method for where like clause
in
Builder at line 94
Builder
orLike(string $column, $value, string $side = 'both')
Convenient method for or where like clause
in
Builder at line 113
protected $this
searchInternal($term, array $columns, $mode, $boolean)
Internal method to apply a search constraint to the query.
Mode can be any of these options:
- all: result must contain all words
- any: result can contain any word
- exact: result must contain the exact phrase
in
Builder at line 148
protected
likeInternal($column, $value, $side = null, $boolean = 'and')
No description
in
Builder at line 178
array
pluckDates(string $column, string $keyFormat = 'Y-m', string $valueFormat = 'F Y')
Get an array with the values of dates.
in
Builder at line 211
LengthAwarePaginator
paginate(int $perPage = null, int|null $page = null, array $columns = ['*'], string $pageName = 'page')
Paginate the given query.
in
Builder at line 247
Paginator
simplePaginate(int $perPage = null, int|null $page = null, array $columns = ['*'], string $pageName = 'page')
Paginate the given query into a simple paginator.
in
Builder at line 282
Model
findOrNew(mixed $id, array $columns = ['*'])
Find a model by its primary key or return fresh model instance with filled attributes to use with forms.
at line 33
array
getNodeData(mixed $id, bool $required = false)
Get node's lft
and rgt
values.
at line 59
array
getPlainNodeData(mixed $id, bool $required = false)
Get plain node data.
at line 69
$this
whereIsRoot()
Scope limits query to select just root node.
at line 87
$this
whereAncestorOf(mixed $id, bool $andSelf = false, string $boolean = 'and')
Limit results to ancestors of specified node.
at line 131
$this
orWhereAncestorOf($id, bool $andSelf = false)
No description
at line 141
Builder
whereAncestorOrSelf($id)
No description
at line 155
Collection
ancestorsOf(mixed $id, array $columns = ['*'])
Get ancestors of specified node.
at line 166
Collection
ancestorsAndSelf($id, array $columns = ['*'])
No description
at line 181
$this
whereNodeBetween(array $values, string $boolean = 'and', bool $not = false)
Add node selection statement between specified range.
at line 196
$this
orWhereNodeBetween(array $values)
Add node selection statement between specified range joined with or
operator.
at line 212
$this
whereDescendantOf(mixed $id, string $boolean = 'and', bool $not = false, bool $andSelf = false)
Add constraint statement to descendants of specified node.
at line 236
Builder
whereNotDescendantOf(mixed $id)
No description
at line 246
Builder
orWhereDescendantOf(mixed $id)
No description
at line 256
Builder
orWhereNotDescendantOf(mixed $id)
No description
at line 268
$this
whereDescendantOrSelf($id, string $boolean = 'and', bool $not = false)
No description
at line 283
Collection
descendantsOf(mixed $id, array $columns = ['*'], bool $andSelf = false)
Get descendants of specified node.
at line 299
Collection
descendantsAndSelf($id, array $columns = ['*'])
No description
at line 311
protected $this
whereIsBeforeOrAfter($id, $operator, $boolean)
No description
at line 347
$this
whereIsAfter(mixed $id, string $boolean = 'and')
Constraint nodes to those that are after specified node.
at line 361
$this
whereIsBefore(mixed $id, string $boolean = 'and')
Constraint nodes to those that are before specified node.
at line 369
$this
whereIsLeaf()
No description
at line 381
Builder[]|Collection
leaves(array $columns = ['*'])
No description
at line 393
$this
withDepth(string $as = 'depth')
Include depth level into the result.
at line 422
protected array
wrappedColumns()
Get wrapped lft
and rgt
column names.
at line 438
protected string
wrappedTable()
Get a wrapped table name.
at line 449
protected string
wrappedKey()
Wrap model's key name.
at line 459
$this
withoutRoot()
Exclude root node from the result.
at line 474
$this
hasParent()
deprecated
deprecated
Equivalent of withoutRoot
.
at line 489
$this
hasChildren()
deprecated
deprecated
Get only nodes that have children.
at line 505
$this
defaultOrder(string $dir = 'asc')
Order by node position.
at line 519
$this
reversed()
Order by reversed node position.
at line 532
int
moveNode(mixed $key, int $position)
Move a node to the new position.
at line 584
int
makeGap(int $cut, int $height)
Make or remove gap in the tree. Negative height will remove gap.
at line 604
protected array
patch(array $params)
Get patch for columns.
at line 626
protected string
columnPatch(string $col, array $params)
Get patch for single column.
at line 657
array
countErrors()
Get statistics of errors of the tree.
at line 687
protected Builder
getOdnessQuery()
No description
at line 703
protected Builder
getDuplicatesQuery()
No description
at line 733
protected Builder
getWrongParentQuery()
No description
at line 774
protected $this
getMissingParentQuery()
No description
at line 809
int
getTotalErrors()
Get the number of total errors of the tree.
at line 820
bool
isBroken()
Get whether the tree is broken.
at line 832
int
fixTree()
Fixes the tree based on parentage info.
Nodes with invalid parent are saved as roots.
at line 855
static protected int
fixNodes(array $dictionary)
No description
at line 881
static protected int
reorderNodes(array $dictionary, int $fixed, $parentId = null, int $cut = 1)
No description
at line 924
int
rebuildTree(array $data, bool $delete = false)
Rebuild the tree based on raw data.
If item data does not contain primary key, new node will be created.
at line 966
protected
buildRebuildDictionary(array $dictionary, array $data, array $existing, mixed $parentId = null)
No description
at line 1008
$this
applyNestedSetScope(string|null $table = null)
No description
at line 1020
Builder
root(array $columns = ['*'])
Get the root node.