Lookitsatravis\Listify\Listify::updatePositions PHP Method

updatePositions() private method

Updates all items based on the original position of the item and the new position of the item
private updatePositions ( ) : void
return void
    private function updatePositions()
    {
        $old_position = $this->getOriginal()[$this->positionColumn()];
        $new_position = $this->getListifyPosition();
        if ($new_position === NULL) {
            $matching_position_records = 0;
        } else {
            $matching_position_records = $this->listifyList()->where($this->positionColumn(), '=', $new_position)->count();
        }
        if ($matching_position_records <= 1) {
            return;
        }
        $this->shufflePositionsOnIntermediateItems($old_position, $new_position, $this->id);
    }