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