title: Laravel query, most sold product
body: <p>I want to find the most sold product today in laravel:</p>
  
  <p>order:id, id_client<br>
  order_items: id_order, id_product, quantity, price</p>
  
  <pre><code> $max=Order::join('orders_item','orders.id', '=','orders_item.id_order')
  
              -&gt;whereDate('orders.created_at','=', date('Y-m-d'))
              -&gt;select('id_product')
              -&gt;groupBy('id_order')
              -&gt;max('quantity');
  
  $most_sold_product_today=Order::join('orders_item','orders.id', '=','orders_item.id_order')
  
            -&gt;where('orders_item.quantity','=',$max)
              -&gt;whereDate('orders.created_at','=', date('Y-m-d'))
              -&gt;get();
  </code></pre>
  
  <p>But I don't get 5 most products, but I know that the query isn't correct. Can you please help me ? </p>