The Arr::prependKeysWith() function is a helper function provided by Laravel’s Arr class. It adds a prefix to each key in an associative array. The function takes two parameters: the modified array and the added prefix.
Here is an example of usage:
use Illuminate\Support\Arr; $data = [ 'name' => 'John', 'age' => 30, ]; $prefixed = Arr::prependKeysWith($data, 'user_'); // Output: ['user_name' => 'John', 'user_age' => 30]