title: OrderBy on Eloquent whereHas relationship
body: <p>I have a simple page which lists counties and there related items under headings. These items need to be <code>approved</code>, hence the whereHas method.</p>
  
  <p>I currently have the following eloquent query;</p>
  
  <pre><code>$counties = County::whereHas('items', function ($query) {
      $query-&gt;where('approved', 1);
  })-&gt;get();
  </code></pre>
  
  <p>The <code>items</code> returned are currently ordered by their primary field <code>id</code> (it would seem), however I want to list these items alphabetically by their <code>name</code> field.</p>
  
  <p>I have tried the following query, but this does change anything. Any advice would be appreciated?</p>
  
  <pre><code>$counties = County::whereHas('items', function ($query) {
      $query-&gt;where('approved', 1)-&gt;orderBy('name');
  })-&gt;get();
  </code></pre>