title: Laravel grouped collection returns object instead of array
body: <p>I have the following query</p>
  
  <pre><code>$outings = Outing::all()-&gt;groupBy(function ($item) {
     return Carbon::parse($item['start'])-&gt;format('m/d/Y');
  });
  
  return response()-&gt;json([
      'outings' =&gt; $outings
  ], 200);
  </code></pre>
  
  <p>The response is returning an object and I need it to return an array
  <a href="https://i.stack.imgur.com/n5adA.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/n5adA.jpg" alt="As you can see, outings is an object and not an array"></a></p>
  
  <p>How can I get outings to be an array instead of an object.</p>
  
  <p>If I don't group the collection and just do </p>
  
  <pre><code>Outing::all();
  </code></pre>
  
  <p>It will return an array rather than an object. The Group by is doing something weird.</p>
  
  <p>If I DD($outings) it does in fact return a collection, so I think it's odd that it gets cast to an object when returned to the browser rather than an array.</p>
  
  <p>Below is the output when I DD($outings->toArray())</p>
  
  <p><a href="https://i.stack.imgur.com/P09KQ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/P09KQ.jpg" alt="enter image description here"></a></p>
  
  <p>Thanks</p>