$data = [ 'user' => [ 'name' => 'John Doe', 'email' => 'john@doe.com' ] ];
use Illuminate\Support\Arr; Arr::set($data, 'user.email', 'jane@doe.com');
[ 'user' => [ 'name' => 'John Doe', 'email' => 'jane@doe.com' ] ]The Arr::set() method can be useful when working with complex arrays or when you need to update an array in a recursive manner. Overall, the Arr::set() method is a useful function provided by the php illuminate/support package library that can simplify working with arrays in PHP.