title: Laravel 5.4 sortBy() not working when returned as JSON
body: <p><a href="https://laravel.com/docs/5.4/collections#method-sortby" rel="nofollow noreferrer">Laravel Doc</a></p>
  
  <p>My laravel Version 
  const VERSION = '5.4.15';</p>
  
  <p>HomeController</p>
  
  <pre><code>$collection = collect([
      ['name' =&gt; 'Desk', 'price' =&gt; 200],
      ['name' =&gt; 'Chair', 'price' =&gt; 100],
      ['name' =&gt; 'Bookcase', 'price' =&gt; 150],
  ]);
  
  $sorted = $collection-&gt;sortBy('price');
  
  $sorted-&gt;values()-&gt;all();
  
  return $sorted;
  </code></pre>
  
  <p>Result when returned as JSON:</p>
  
  <pre><code>{
       0: {
            name: "Desk",
            price: 200
       },
       1: {
            name: "Chair",
            price: 100
       },
       2: {
            name: "Bookcase",
            price: 150
       }
   }
  </code></pre>
  
  <p>What did I miss? Why isn't <code>sortBy</code> working? </p>