Sorting or collection or array according to index in laravel 5.1
<p>I have the following collection in laravel:</p>

<pre><code>Collection {#357 ▼
  #items: array:11 [▼
    "29-04-2016" =&gt; array:2 [▼
      "posTotal" =&gt; "100"
      "posCount" =&gt; 1
    ]
    "05-05-2016" =&gt; array:6 [▼
      "posTotal" =&gt; "11"
      "posCount" =&gt; 1
      "keyedTotal" =&gt; "120"
      "keyedCount" =&gt; 1
      "cashTotal" =&gt; "32"
      "cashCount" =&gt; 2
    ]
    "10-05-2016" =&gt; array:10 [▼
      "posTotal" =&gt; "67"
      "posCount" =&gt; 4
      "keyedTotal" =&gt; "22"
      "keyedCount" =&gt; 1
      "cashcardTotal" =&gt; "123"
      "cashcardCount" =&gt; 1
      "refundTotal" =&gt; "-50"
      "refundCount" =&gt; 1
      "cashRefundTotal" =&gt; "-10"
      "cashRefundCount" =&gt; 1
    ]
    "17-05-2016" =&gt; array:2 [▶]
    "06-05-2016" =&gt; array:2 [▶]
    "16-05-2016" =&gt; array:2 [▶]
    "22-04-2016" =&gt; array:2 [▶]
    "25-04-2016" =&gt; array:2 [▶]
  ]
}
</code></pre>

<p>Now i wanted to sort it by index but needs to convert it as per date.</p>

<p>For e.g. I wanted to show </p>

<pre><code> "17-05-2016" =&gt; array:2 [▶]
 "10-05-2016" =&gt; array:10 [▶]
"06-05-2016" =&gt; array:2 [▶]
</code></pre>

<p>and so on...</p>

<p>I've tried laravel's sort collection method and also tried php's ksort function converting collection to array. But it's taking it as a string.</p>