title: Sum same data collection laravel
body: <p>I have data collection like this</p>
  <pre><code>illuminate\support\collection
  
  items: array(3)
      0: array(5)
          user_id: '1'
          mode: 'doci'
          channel: 1
          total: 1
          addition: &quot;[{&quot;cash&quot;:0}]&quot;
      1: array(5)
          user_id: '1'
          mode: 'doci'
          channel: 1
          total: 1
          addition: &quot;[{&quot;cash&quot;:0}]&quot;
      2: array(5)
          user_id: '1'
          mode: 'doci'
          channel: 1
          total: 1
          addition: &quot;[{&quot;cash&quot;:10}]&quot;
  </code></pre>
  <p>as you can see index 0 and 1 are same. And I wanna sum total of them because the data are same.</p>
  <p>and I have trying this</p>
  <pre><code>$collection = collect([]);
  
  $data-&gt;each(function ($item) use ($collection) {
      $target = $collection-&gt;where('user_id', $item['user_id'])
          -&gt;where('mode', $item['mode'])
          -&gt;where('channel', $item['channel'])
          -&gt;where('addition', $item['addition']);
  
    if ($target-&gt;count() == 0) {
      $collection-&gt;push($item);
    } else {
      $target-&gt;first()['total'] += $item['total'];
    }
  });
      
  $data = $collection;
  </code></pre>
  <p>and resulting this</p>
  <pre><code>illuminate\support\collection
  
  items: array(3)
      0: array(5)
          user_id: '1'
          mode: 'doci'
          channel: 1
          total: 1    -&gt; expected result is 2 but that still 1
          addition: &quot;[{&quot;cash&quot;:0}]&quot;
      2: array(5)
          user_id: '1'
          mode: 'doci'
          channel: 1
          total: 1
          addition: &quot;[{&quot;cash&quot;:10}]&quot;
  </code></pre>
  <p>Expected result on index 0 and key total is 2, but existing resulting 1
  What I missed?</p>