title: get monthly sum in laravel
body: <p>I have two arrays in laravel containing first day of every month for current year and previous year. </p>
  
  <pre><code>$current_month = new \Carbon\Carbon('first day of this month');
      $prevyear_month = new \Carbon\Carbon('first day of this month last year');
  
      $current_year = array();
      $prev_year = array();
  
      array_push($prev_year, $prevyear_month-&gt;toDateString());
      array_push($current_year, $current_month-&gt;toDateString());
  
      for($i = 1; $i&lt;12; $i++)
      {
          $temp = $current_month-&gt;addMonth();
          $temp_prev = $prevyear_month-&gt;addMonth();
  
          array_push($current_year, $temp-&gt;toDateString());
          array_push($prev_year, $temp_prev-&gt;toDateString());
      }
  </code></pre>
  
  <p>this is the outcome</p>
  
  <pre><code>Array ( [0] =&gt; 2016-03-01 [1] =&gt; 2016-04-01 [2] =&gt; 2016-05-01 [3] =&gt; 2016-06-01 [4] =&gt; 2016-07-01 [5] =&gt; 2016-08-01 [6] =&gt; 2016-09-01 [7] =&gt; 2016-10-01 [8] =&gt; 2016-11-01 [9] =&gt; 2016-12-01 [10] =&gt; 2017-01-01 [11] =&gt; 2017-02-01 ) 
  Array ( [0] =&gt; 2015-03-01 [1] =&gt; 2015-04-01 [2] =&gt; 2015-05-01 [3] =&gt; 2015-06-01 [4] =&gt; 2015-07-01 [5] =&gt; 2015-08-01 [6] =&gt; 2015-09-01 [7] =&gt; 2015-10-01 [8] =&gt; 2015-11-01 [9] =&gt; 2015-12-01 [10] =&gt; 2016-01-01 [11] =&gt; 2016-02-01 )
  </code></pre>
  
  <p>I'm trying to get sum of all those months, but don't know how to go about it.  I'm fine with doing raw query if thats the way to go.</p>
  
  <p>Table has rows for every single day. with date column (carbon style ex. 2016-01-01) and column for revenue. I'm trying to get sum of revenue for every month in arrays above. </p>