title: Laravel Grouping by Eloquent Relationship
body: <p>How can I group by relation?</p>
  
  <p>Example</p>
  
  <pre><code>Sales::with('product_detail.product')-&gt;groupBy('product_name')-&gt;get()
  </code></pre>
  
  <p>How can I get a result with eloquent code?</p>