Skip to content

Commit 5858b93

Browse files
committed
Fixed command set and added $this context when setting disable position
1 parent bd4076c commit 5858b93

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Commands/RecalculatePositionCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function handle()
6565
/** @var PositionTrait|Model $model */
6666
foreach ($collection as $model) {
6767
// Prevent the move action and force the position we set
68-
$model->disablePositionUpdate = true;
68+
$model->setDisablePositionUpdateAttribute(true);
6969

7070
// Builds the group key to get position
7171
$groupKey = $this->buildGroupKeyForPosition($model, $groups);

src/Traits/BasePositionTrait.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,26 @@ protected function resetPositionOptionCache()
128128
* Enables setting disablePositionUpdate option in runtime
129129
*
130130
* @param boolean $value
131+
*
132+
* @return $this
131133
*/
132134
public function setDisablePositionUpdateAttribute($value)
133135
{
134136
$this->optionCache['disablePositionUpdate'] = $value;
137+
return $this;
135138
}
136139

137140
/**
138141
* Enables setting positionColumn option in runtime
139142
*
140143
* @param string $value
144+
*
145+
* @return $this
141146
*/
142147
public function setPositionColumnAttribute($value)
143148
{
144149
$this->optionCache['positionColumn'] = $value;
150+
return $this;
145151
}
146152
//endregion
147153
}

0 commit comments

Comments
 (0)