title: Is there a way to return 0 for months with no data?
body: <p>I'm using Chart.js to show the total number of transactions (count) for each month.</p>
  <pre><code>$dataTotal = ModelName::select(DB::raw('count(id) as count'), DB::raw(&quot;MONTH(created_at)  as month&quot;)) 
                          -&gt;where('org_id', auth()-&gt;user()-&gt;org_id)
                          -&gt;where('result_code', 200)
                          -&gt;groupBy('month')
                          -&gt;orderBy('month')
                          -&gt;get()
                          -&gt;toArray();
  </code></pre>
  <p>The query itself is fine, except for the problem that if there is no records in a month then it doesn't return <code>0</code> for that month. Which results in the graph not rendering properly.</p>
  <p>Does anyone have any suggestions, on how i can implement it so that i receive full resultsets?</p>
  <p>The desired format is:</p>
  <pre><code>array (
  0 =&gt; 
  array (
    'count' =&gt; 0,
    'month' =&gt; 1,
  ),
  1 =&gt; 
  array (
    'count' =&gt; 5,
    'month' =&gt; 2,
  ),
  2 =&gt; 
  array (
    'count' =&gt; 0,
    'month' =&gt; 3,
  ),
  3 =&gt; 
  array (
    'count' =&gt; 4,
    'month' =&gt; 4,
  ),
  4 =&gt; 
  array (
    'count' =&gt; 0,
    'month' =&gt; 5,
  ),
  5 =&gt; 
  array (
    'count' =&gt; 4,
    'month' =&gt; 6,
  ),
  6 =&gt; 
  array (
    'count' =&gt; 51225,
    'month' =&gt; 7,
  ),
  7 =&gt; 
  array (
    'count' =&gt; 4,
    'month' =&gt; 8,
  ),
  8 =&gt; 
  array (
    'count' =&gt; 0,
    'month' =&gt; 9,
  ),
  9 =&gt; 
  array (
    'count' =&gt; 0,
    'month' =&gt; 10,
  ),
  10 =&gt; 
  array (
    'count' =&gt; 0,
    'month' =&gt; 11,
  ),
  11 =&gt; 
  array (
    'count' =&gt; 0,
    'month' =&gt; 12,
  ),
  
  )  
  </code></pre>