title: laravel sort an array by date
body: <p>hello friends I have an array that looks like this:</p>
  
  <pre><code>array:3 [▼
    0 =&gt; array:6 [▼
      "date" =&gt; "2016-05-31 15:08:33"
      0 =&gt; "31 May 16"
      1 =&gt; "aze"
      2 =&gt; "2"
      3 =&gt; "hi"
      4 =&gt; "487841464704194.jpg"
    ]
    1 =&gt; array:6 [▼
      "date" =&gt; "2016-05-31 15:26:09"
      0 =&gt; "31 May 16"
      1 =&gt; "aze"
      2 =&gt; "2"
      3 =&gt; "hey"
      4 =&gt; "487841464704194.jpg"
    ]
    2 =&gt; array:6 [▼
      "date" =&gt; "2016-06-01 11:33:06"
      0 =&gt; "01 Jun 16"
      1 =&gt; "aze"
      2 =&gt; "2"
      3 =&gt; "Dm me please"
      4 =&gt; "487841464704194.jpg"
    ]
  ]
  </code></pre>
  
  <p>My goal is to sort it by the <code>date</code>. So from new to old.</p>
  
  <p>If tried this:</p>
  
  <pre><code>$comarrSorted = $comarr-&gt;sortByDesc('date');
  dd($comarrSorted);
  </code></pre>
  
  <p>But I get this nasty error:</p>
  
  <pre><code>Call to a member function sortByDesc() on array
  </code></pre>
  
  <p>Anyone can help me out? I guess the error is caused because it's a collection function? Is it not possible to sort my array with this function?</p>
  
  <p>Many Thanks in advance!</p>