title: How to order by another table join by eager loading in Laravel
body: <p>I got product and stocks table;</p>
  
  <p><strong>products</strong></p>
  
  <pre><code>id int
  name varchar
  created_at timestamp
  </code></pre>
  
  <p><strong>stocks</strong></p>
  
  <pre><code>id int
  name varchar
  product_id varchar
  created_at timestamp
  </code></pre>
  
  <p><strong>Product Model</strong></p>
  
  <pre><code>public function validStock() {
      return $this-&gt;hasMany('Stock')-&gt;where('quantity', '&gt;', 10);
  }
  </code></pre>
  
  <p>If both have created_at, how to order by stocks's created_at, I've tried two methods and it's not work</p>
  
  <pre><code>Product::with('validStock')-&gt;orderBy('validStock.created_at', 'DESC');
  
  Product::with(array('validStock' =&gt; function($q) {
      $q-&gt;orderBy('created_at', 'DESC');
  }));
  </code></pre>