Let's say I have this PHP code using Laravel 5.6:
$action = [
[
"name" => "action",
"value" => "DepositMoney"
],
[
"name" => "coins",
"type" => "number",
"value" => "534"
]
];
return collect($action)->map(function($item, $key) {
return [
$item['name'] => $item['value']
];
});
which produces:
[
{
"action": "DepositMoney"
},
{
"coins": "534"
}
]
How do I make it so I can merge those together and produce this instead (using something from here: https://laravel.com/docs/5.6/eloquent-collections#available-methods):
[
"action" => "DepositMoney",
"coins" => "534"
]
Thanks. This is for form_params
on Guzzle.