src/Listify.php
protected function updateListifyPositions()
    {
        $newPosition = $this->getListifyPosition();

        // check for duplicate positions and resolve them if required
        if (null === $newPosition) return;

        $count = $this->listifyScopedQuery()
            ->where($this->positionColumn(), $newPosition)
            ->count();

        if ($count < 2) return;

        $oldPosition = Arr::get($this->getOriginal(), $this->positionColumn(), false);

        if (false === $oldPosition) return;

        // reorder positions while excluding the current model
        $this->reorderPositionsOnItemsBetween($oldPosition, $newPosition, $this->id);
    }
protected function updateListifyPositions()
    {
        $newPosition = $this->getListifyPosition();

        // check for duplicate positions and resolve them if required
        if (null === $newPosition) return;

        $count = $this->listifyScopedQuery()
            ->where($this->positionColumn(), $newPosition)
            ->count();

        if ($count < 2) return;

        $oldPosition = Arr::get($this->getOriginal(), $this->positionColumn(), false);

        if (false === $oldPosition) return;

        // reorder positions while excluding the current model
        $this->reorderPositionsOnItemsBetween($oldPosition, $newPosition, $this->id);
    }
protected function updateListifyPositions ( ) { $ newPosition = $ this -> getListifyPosition ( ) ; // check for duplicate positions and resolve them if required if ( null === $ newPosition ) return ; $ count = $ this -> listifyScopedQuery ( ) -> where ( $ this -> positionColumn ( ) , $ newPosition ) -> count ( ) ; if ( $ count < 2 ) return ; $ oldPosition = Arr :: get ( $ this -> getOriginal ( ) , $ this -> positionColumn ( ) , false ) ; if ( false === $ oldPosition ) return ; // reorder positions while excluding the current model $ this -> reorderPositionsOnItemsBetween ( $ oldPosition , $ newPosition , $ this -> id ) ; }
Updates all record positions based on changed position of the record in the current list.
Updates all record positions based on changed position of the record in the current list .