title: How to get sale order list (transaction) in Laravel?
body: <p>I have two database tables, 'product' and 'transactions' as be low</p>
  
  <pre><code>**Product.php**
  
  product_id   product_name
  --------------------------
  1           |      A
  2           |      B
  3           |      C
  
  **Transactions.php**
  
  transaction_id       product_id
  --------------------------------
  1                |       1
  2                |       1
  3                |       1
  4                |       3
  5                |       2
  6                |       3
  </code></pre>
  
  <p>From transaction table. So the sale order (best sale) is
  [A C B]. I tried something like below but not work.</p>
  
  <pre><code>$saleTtransaction = SaleTransaction::select('product_id', DB::raw('count(*) as total'))-&gt;groupBy('product_id')-&gt;get();
  </code></pre>
  
  <p>Appreciated for all comments, thanks.</p>