src/Listify.php
protected function reorderPositionsOnItemsBetween($positionBefore, $positionAfter, $ignoreId = null)
    {
        if ($positionBefore == $positionAfter) {
            return;
        }

        $query = $this->listifyScopedQuery();

        if ($ignoreId) {
            $query->where($this->getPrimaryKey(), '!=', $ignoreId);
        }

        if ($positionBefore < $positionAfter) {
            // increment the in-between positions

            $query
                ->where($this->positionColumn(), '>', $positionBefore)
                ->where($this->positionColumn(), '<=', $positionAfter)
                ->decrement($this->positionColumn());

        } else {
            // decrement the in-between positions

            $query
                ->where($this->positionColumn(), '>=', $positionAfter)
                ->where($this->positionColumn(), '<', $positionBefore)
                ->increment($this->positionColumn());
        }
    }
protected function reorderPositionsOnItemsBetween($positionBefore, $positionAfter, $ignoreId = null)
    {
        if ($positionBefore == $positionAfter) {
            return;
        }

        $query = $this->listifyScopedQuery();

        if ($ignoreId) {
            $query->where($this->getPrimaryKey(), '!=', $ignoreId);
        }

        if ($positionBefore < $positionAfter) {
            // increment the in-between positions

            $query
                ->where($this->positionColumn(), '>', $positionBefore)
                ->where($this->positionColumn(), '<=', $positionAfter)
                ->decrement($this->positionColumn());

        } else {
            // decrement the in-between positions

            $query
                ->where($this->positionColumn(), '>=', $positionAfter)
                ->where($this->positionColumn(), '<', $positionBefore)
                ->increment($this->positionColumn());
        }
    }
protected function reorderPositionsOnItemsBetween ( $ positionBefore , $ positionAfter , $ ignoreId = null ) { if ( $ positionBefore == $ positionAfter ) { return ; } $ query = $ this -> listifyScopedQuery ( ) ; if ( $ ignoreId ) { $ query -> where ( $ this -> getPrimaryKey ( ) , '!=' , $ ignoreId ) ; } if ( $ positionBefore < $ positionAfter ) { // increment the in-between positions $ query -> where ( $ this -> positionColumn ( ) , '>' , $ positionBefore ) -> where ( $ this -> positionColumn ( ) , '<=' , $ positionAfter ) -> decrement ( $ this -> positionColumn ( ) ) ; } else { // decrement the in-between positions $ query -> where ( $ this -> positionColumn ( ) , '>=' , $ positionAfter ) -> where ( $ this -> positionColumn ( ) , '<' , $ positionBefore ) -> increment ( $ this -> positionColumn ( ) ) ; } }
Reorders the positions of all items between two affected positions.

@param integer      $positionBefore
@param integer      $positionAfter
@param null|integer $ignoreId
Reorders the positions of all items between two affected positions .