2
您好我有一些truble計算如何使用選擇內wherehas查詢或我是我以錯誤的方式做? 查詢工作,但它沒有選擇。Laravel使用選擇裏面whereHas
$query = $query->whereHas('orderProducts', function($q){
$q->select(DB::raw('SUM(order_product.total) AS spent_total'));
$q->select(DB::raw('COUNT(order_product.box_id) as box_count'));
});
謝謝。