title: Group array items with eloquent
body: <p>I have the following eloquent query:</p>
  
  <pre><code>$extras = EventExtra::select('id', 'category', 'name', 'price', 'description', 'company')-&gt;get();
  </code></pre>
  
  <p>It gets some data from me from my database.  What i want is for the returned data to be grouped twice, first by the category and then second by the company so that in the end i have something like this returned to the client:</p>
  
  <pre><code>    [
    {
      "name": "donation",
      "collection": [
          {
            "name": "sampleCompany1",
            "array": [
              {
                "name": "extra1",
                "description": "",
                "value": ""
              },
              {
                "name": "extra4",
                "description": "",
                "value": ""
              },
              {
                "name": "extra6",
                "description": "",
                "value": ""
              }
            ]
          }
        ]
    },
  {
    "name": "donation",
    "collection":  [
        {
          "name": "sampleCompany2",
          "array": [
            {
              "name": "extra2",
              "description": "",
              "value": ""
            },
            {
              "name": "extra3",
              "description": "",
              "value": ""
            }
          ]
        }
      ]
  }]
  </code></pre>
  
  <p>I just typed the above myself so it might not be valid object array but basically it shows what i want to accomplish here.</p>