title: Order by count in many to many polymorphic relation in Laravel
body: <p>Let's take the example from the doc : <a href="https://laravel.com/docs/5.7/eloquent-relationships#many-to-many-polymorphic-relations" rel="nofollow noreferrer">https://laravel.com/docs/5.7/eloquent-relationships#many-to-many-polymorphic-relations</a> it's easy to get all <code>posts</code> with their <code>tags</code> count doing <code>Post::withCount('tags')-&gt;get()</code>.</p>
  
  <p>But how to get all <code>tags</code> with their usage count ? To have them ordered by most used / less used.</p>
  
  <p>If I do <code>Tag::withCount(['video', 'post'])-&gt;get()</code> I will have 2 attributes <code>videos_count</code> and <code>posts_count</code>. In my case I would like a unique <code>taggables_count</code> that will be the sum of the two. In a perfect world by adding a subselect querying the pivot table.</p>