@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | ELSE ${wrappedParent} END"; |
136 | 136 | |
137 | 137 | $updateConditions = [ |
138 | - $leftColumn => $connection->raw($lftSql), |
|
139 | - $rightColumn => $connection->raw($rgtSql), |
|
140 | - $parentColumn => $connection->raw($parentSql), |
|
138 | + $leftColumn => $connection->raw($lftSql), |
|
139 | + $rightColumn => $connection->raw($rgtSql), |
|
140 | + $parentColumn => $connection->raw($parentSql), |
|
141 | 141 | ]; |
142 | 142 | |
143 | 143 | if ($this->node->timestamps) { |
@@ -220,22 +220,22 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | switch ($this->position) { |
223 | - case 'child': |
|
223 | + case 'child': |
|
224 | 224 | $this->_bound1 = $this->target->getRight(); |
225 | 225 | |
226 | 226 | break; |
227 | 227 | |
228 | - case 'left': |
|
228 | + case 'left': |
|
229 | 229 | $this->_bound1 = $this->target->getLeft(); |
230 | 230 | |
231 | 231 | break; |
232 | 232 | |
233 | - case 'right': |
|
233 | + case 'right': |
|
234 | 234 | $this->_bound1 = $this->target->getRight() + 1; |
235 | 235 | |
236 | 236 | break; |
237 | 237 | |
238 | - case 'root': |
|
238 | + case 'root': |
|
239 | 239 | $this->_bound1 = $this->node->newNestedSetQuery()->max($this->node->getRightColumnName()) + 1; |
240 | 240 | |
241 | 241 | break; |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | // we have defined the boundaries of two non-overlapping intervals, |
278 | 278 | // so sorting puts both the intervals and their boundaries in order |
279 | 279 | $this->_boundaries = [ |
280 | - $this->node->getLeft(), |
|
281 | - $this->node->getRight(), |
|
282 | - $this->bound1(), |
|
283 | - $this->bound2(), |
|
280 | + $this->node->getLeft(), |
|
281 | + $this->node->getRight(), |
|
282 | + $this->bound1(), |
|
283 | + $this->bound2(), |
|
284 | 284 | ]; |
285 | 285 | sort($this->_boundaries); |
286 | 286 | |
@@ -295,13 +295,13 @@ discard block |
||
295 | 295 | protected function parentId() |
296 | 296 | { |
297 | 297 | switch ($this->position) { |
298 | - case 'root': |
|
298 | + case 'root': |
|
299 | 299 | return null; |
300 | 300 | |
301 | - case 'child': |
|
301 | + case 'child': |
|
302 | 302 | return $this->target->getKey(); |
303 | 303 | |
304 | - default: |
|
304 | + default: |
|
305 | 305 | return $this->target->getParentId(); |
306 | 306 | } |
307 | 307 | } |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | protected function applyLockBetween(int $lft, int $rgt): void |
400 | 400 | { |
401 | 401 | $this->node->newQuery() |
402 | - ->where($this->node->getLeftColumnName(), '>=', $lft) |
|
403 | - ->where($this->node->getRightColumnName(), '<=', $rgt) |
|
404 | - ->select($this->node->getKeyName()) |
|
405 | - ->lockForUpdate() |
|
406 | - ->get(); |
|
402 | + ->where($this->node->getLeftColumnName(), '>=', $lft) |
|
403 | + ->where($this->node->getRightColumnName(), '<=', $rgt) |
|
404 | + ->select($this->node->getKeyName()) |
|
405 | + ->lockForUpdate() |
|
406 | + ->get(); |
|
407 | 407 | } |
408 | 408 | } |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | abstract public function isDirty($attributes = null); |
138 | 138 | |
139 | 139 | /** |
140 | - * Define an inverse one-to-one or many relationship. |
|
141 | - * |
|
142 | - * @param string $related |
|
143 | - * @param string|null $foreignKey |
|
144 | - * @param string|null $ownerKey |
|
145 | - * @param string|null $relation |
|
146 | - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
147 | - */ |
|
140 | + * Define an inverse one-to-one or many relationship. |
|
141 | + * |
|
142 | + * @param string $related |
|
143 | + * @param string|null $foreignKey |
|
144 | + * @param string|null $ownerKey |
|
145 | + * @param string|null $relation |
|
146 | + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
147 | + */ |
|
148 | 148 | abstract public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null); |
149 | 149 | |
150 | 150 | /** |
@@ -172,30 +172,30 @@ discard block |
||
172 | 172 | abstract public function getConnection(); |
173 | 173 | |
174 | 174 | /** |
175 | - * Get the parent column name. |
|
176 | - * |
|
177 | - * @return string |
|
178 | - */ |
|
175 | + * Get the parent column name. |
|
176 | + * |
|
177 | + * @return string |
|
178 | + */ |
|
179 | 179 | public function getParentColumnName(): string |
180 | 180 | { |
181 | 181 | return $this->parentColumn; |
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | - * Get the table qualified parent column name. |
|
186 | - * |
|
187 | - * @return string |
|
188 | - */ |
|
185 | + * Get the table qualified parent column name. |
|
186 | + * |
|
187 | + * @return string |
|
188 | + */ |
|
189 | 189 | public function getQualifiedParentColumnName(): string |
190 | 190 | { |
191 | 191 | return $this->getTable().'.'.$this->getParentColumnName(); |
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
195 | - * Get the value of the models "parent_id" field. |
|
196 | - * |
|
197 | - * @return int|string |
|
198 | - */ |
|
195 | + * Get the value of the models "parent_id" field. |
|
196 | + * |
|
197 | + * @return int|string |
|
198 | + */ |
|
199 | 199 | public function getParentId() |
200 | 200 | { |
201 | 201 | return $this->getAttribute($this->getparentColumnName()); |
@@ -361,20 +361,20 @@ discard block |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
364 | - * Parent relation (self-referential) 1-1. |
|
365 | - * |
|
366 | - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
367 | - */ |
|
364 | + * Parent relation (self-referential) 1-1. |
|
365 | + * |
|
366 | + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
367 | + */ |
|
368 | 368 | public function parent(): BelongsTo |
369 | 369 | { |
370 | 370 | return $this->belongsTo(get_class($this), $this->getParentColumnName()); |
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
374 | - * Children relation (self-referential) 1-N. |
|
375 | - * |
|
376 | - * @return \Illuminate\Database\Eloquent\Relations\HasMany |
|
377 | - */ |
|
374 | + * Children relation (self-referential) 1-N. |
|
375 | + * |
|
376 | + * @return \Illuminate\Database\Eloquent\Relations\HasMany |
|
377 | + */ |
|
378 | 378 | public function children(): HasMany |
379 | 379 | { |
380 | 380 | return $this->hasMany(get_class($this), $this->getParentColumnName()) |
@@ -888,11 +888,11 @@ discard block |
||
888 | 888 | } |
889 | 889 | |
890 | 890 | /** |
891 | - * Returns the level of this node in the tree. |
|
892 | - * Root level is 0. |
|
893 | - * |
|
894 | - * @return int |
|
895 | - */ |
|
891 | + * Returns the level of this node in the tree. |
|
892 | + * Root level is 0. |
|
893 | + * |
|
894 | + * @return int |
|
895 | + */ |
|
896 | 896 | public function getLevel(): int |
897 | 897 | { |
898 | 898 | if (is_null($this->getParentId())) { |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | public function isDescendantOf($other): bool |
912 | 912 | { |
913 | 913 | return ( |
914 | - $this->getLeft() > $other->getLeft() && |
|
914 | + $this->getLeft() > $other->getLeft() && |
|
915 | 915 | $this->getLeft() < $other->getRight() && |
916 | 916 | $this->inSameScope($other) |
917 | 917 | ); |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | public function isSelfOrDescendantOf($other): bool |
927 | 927 | { |
928 | 928 | return ( |
929 | - $this->getLeft() >= $other->getLeft() && |
|
929 | + $this->getLeft() >= $other->getLeft() && |
|
930 | 930 | $this->getLeft() < $other->getRight() && |
931 | 931 | $this->inSameScope($other) |
932 | 932 | ); |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | public function isAncestorOf($other): bool |
942 | 942 | { |
943 | 943 | return ( |
944 | - $this->getLeft() < $other->getLeft() && |
|
944 | + $this->getLeft() < $other->getLeft() && |
|
945 | 945 | $this->getRight() > $other->getLeft() && |
946 | 946 | $this->inSameScope($other) |
947 | 947 | ); |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | public function isSelfOrAncestorOf($other): bool |
957 | 957 | { |
958 | 958 | return ( |
959 | - $this->getLeft() <= $other->getLeft() && |
|
959 | + $this->getLeft() <= $other->getLeft() && |
|
960 | 960 | $this->getRight() > $other->getLeft() && |
961 | 961 | $this->inSameScope($other) |
962 | 962 | ); |
@@ -1328,8 +1328,8 @@ discard block |
||
1328 | 1328 | ->where($self->getLeftColumnName(), '>', $self->getLeft()) |
1329 | 1329 | ->where($self->getRightColumnName(), '<', $self->getRight()) |
1330 | 1330 | ->update([ |
1331 | - $self->getDeletedAtColumn() => null, |
|
1332 | - $self->getUpdatedAtColumn() => $self->{$self->getUpdatedAtColumn()}, |
|
1331 | + $self->getDeletedAtColumn() => null, |
|
1332 | + $self->getUpdatedAtColumn() => $self->{$self->getUpdatedAtColumn()}, |
|
1333 | 1333 | ]); |
1334 | 1334 | }); |
1335 | 1335 | } |