src/Collection/Mutable.php
public function moveAfter(string $id, $target): self
    {
        if ($element = $this->find($id)) {
            $this->without($id);

            $targetPosition = $this->position($target);

            if ($targetPosition >= 0) {
                $this->insert($element, $targetPosition + 1)->all();
            }
        }

        return $this;
    }
public function moveAfter(string $id, $target): self
    {
        if ($element = $this->find($id)) {
            $this->without($id);

            $targetPosition = $this->position($target);

            if ($targetPosition >= 0) {
                $this->insert($element, $targetPosition + 1)->all();
            }
        }

        return $this;
    }
public function moveAfter ( string $ id , $ target ) : self { if ( $ element = $ this -> find ( $ id ) ) { $ this -> without ( $ id ) ; $ targetPosition = $ this -> position ( $ target ) ; if ( $ targetPosition >= 0 ) { $ this -> insert ( $ element , $ targetPosition + 1 ) -> all ( ) ; } } return $ this ; }
Move element after another one.

@param string $id
@param $target

@return $this
Move element after another one .