title: How to combine multiple object in Laravel
body: <p>I want to combine my ordered products and display the order list.</p>
  <p>Controller :</p>
  <pre><code>$orders = Order::where('customer_id', 1)-&gt;pluck('products');
  print_r($orders);
  </code></pre>
  <p>This is what I receive:</p>
  <pre><code>Array ( 
  [0] =&gt; 
     [
          {&quot;id&quot;:3,&quot;product_id&quot;:3,&quot;size&quot;:&quot;47&quot;,&quot;quantity&quot;:7,&quot;name&quot;:&quot;Simple Regular T-shirt&quot;,&quot;price&quot;:2200,&quot;thumbnail&quot;:&quot;Thumbnail_614291597.jpg&quot;},
          {&quot;id&quot;:7,&quot;product_id&quot;:4,&quot;size&quot;:&quot;47&quot;,&quot;quantity&quot;:8,&quot;name&quot;:&quot;Simple Regular Shirt&quot;,&quot;price&quot;:123,&quot;thumbnail&quot;:&quot;Thumbnail_91520734.jpg&quot;}
     ] 
  
  [1] =&gt; 
     [
          {&quot;id&quot;:9,&quot;product_id&quot;:3,&quot;size&quot;:&quot;45&quot;,&quot;quantity&quot;:2,&quot;name&quot;:&quot;Simple Regular T-shirt&quot;,&quot;price&quot;:2200,&quot;thumbnail&quot;:&quot;Thumbnail_614291597.jpg&quot;}
     ] 
  )
  </code></pre>
  <p>But I want.</p>
  <pre><code>Array ( 
  [0] =&gt; 
     [
          {&quot;id&quot;:3,&quot;product_id&quot;:3,&quot;size&quot;:&quot;47&quot;,&quot;quantity&quot;:7,&quot;name&quot;:&quot;Simple Regular T-shirt&quot;,&quot;price&quot;:2200,&quot;thumbnail&quot;:&quot;Thumbnail_614291597.jpg&quot;},
          {&quot;id&quot;:7,&quot;product_id&quot;:4,&quot;size&quot;:&quot;47&quot;,&quot;quantity&quot;:8,&quot;name&quot;:&quot;Simple Regular Shirt&quot;,&quot;price&quot;:123,&quot;thumbnail&quot;:&quot;Thumbnail_91520734.jpg&quot;},
          {&quot;id&quot;:9,&quot;product_id&quot;:3,&quot;size&quot;:&quot;45&quot;,&quot;quantity&quot;:2,&quot;name&quot;:&quot;Simple Regular T-shirt&quot;,&quot;price&quot;:2200,&quot;thumbnail&quot;:&quot;Thumbnail_614291597.jpg&quot;}
     ] 
  )
  </code></pre>
  <p>How I can do this?</p>
  <p>I already tried a different way, but I can't do this. Firstly I was trying to convert it array and then use the array_marge() function for those arrays. but that array needs only two arrays but for my case, it is not specified how many arrays the user has given. And try to solve it with a loop (I just tried). I am new in this field.</p>