src/Bag.php
public function setPath($path, $value)
    {
        Deprecated::method(1.1, MutableBag::class);

        Arr::set($this->items, $path, $value);
    }
public function setPath($path, $value)
    {
        Deprecated::method(1.1, MutableBag::class);

        Arr::set($this->items, $path, $value);
    }
Sets a value using path syntax to set nested data.
Inner arrays will be created as needed to set the value.

Example:

// Set an item at a nested structure
$bag->setPath('foo/bar', 'color');

// Append to a list in a nested structure
$bag->get($data, 'foo/baz');
// => null
$bag->setPath('foo/baz/[]', 'a');
$bag->setPath('foo/baz/[]', 'b');
$bag->getPath('foo/baz');
// => ['a', 'b']

This function does not support keys that contain `/` or `[]` characters
because these are special tokens used when traversing the data structure.
A value may be appended to an existing array by using `[]` as the final
key of a path.

<br>
Note: To set values in arrays that are in `ArrayAccess` objects their
`offsetGet()` method needs to be able to return arrays by reference.
See {@see MutableBag} for an example of this.

@param string $path  The path to traverse and set the value at
@param mixed  $value The value to set

@throws \RuntimeException when trying to set a path that travels through a scalar value
@throws \RuntimeException when trying to set a value in an array that is in an `ArrayAccess` object
which cannot retrieve arrays by reference

@deprecated since 1.1 and will be removed in 2.0. Use {@see MutableBag} instead.