File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public function saving($model)
4545 if ($ model ->isPositionUpdateDisabled () === false ) {
4646 // Get the position for current and old value
4747 $ position = $ model ->getPosition ();
48-
48+
4949 // Prevent modifying position column when updating and position columns has not changed
5050 if ($ model ->exists === true && $ model ->isDirty ($ model ->getPositionColumn ()) === false ) {
5151 return ;
@@ -70,7 +70,7 @@ public function saving($model)
7070 *
7171 * @param Model|PositionTrait $model
7272 */
73- public function deleting ($ model )
73+ public function deleted ($ model )
7474 {
7575 if ($ model ->isPositionUpdateDisabled () === false ) {
7676 // Get the old position
Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ public function runQuery($query)
4141 $ lastPosition = $ query ->max ($ this ->model ()->getPositionColumn ()) ?: 0 ;
4242
4343 if (empty ($ this ->oldPosition ) === false ) {
44+ if ($ this ->oldPosition === $ this ->model ->getPosition () && $ lastPosition < $ this ->model ->getPosition ()) {
45+ return ;
46+ }
47+
4448 (new MoveQuery ($ this ->model , $ lastPosition , $ this ->oldPosition ))->run ();
4549 } else if ($ this ->oldPosition === null || $ lastPosition != $ this ->oldPosition ) {
4650 // Check if the last position is not same as original position - the same object
You can’t perform that action at this time.
0 commit comments