src/Bag.php
public function replace($collection)
    {
        return $this->createFrom(array_replace($this->items, Arr::from($collection)));
    }
public function replace($collection)
    {
        return $this->createFrom(array_replace($this->items, Arr::from($collection)));
    }
public function replace ( $ collection ) { return $ this -> createFrom ( array_replace ( $ this -> items , Arr :: from ( $ collection ) ) ) ; }
Replaces items in this bag from the `$collection` by comparing keys and returns the result.

@param iterable $collection The collection from which items will be extracted

@return static
Replaces items in this bag from the $collection by comparing keys and returns the result .