php - Get total of out of stock products, total price added to the inventory records for the user laravel

one text

Solution:

DB::table('itmes')
         ->select('business_id',DB::raw('count(*) as total_number, sum('price') as total_price'))
         ->where('quantity_in_stock', 0)
         ->groupBy('business_id')
         ->get();

Source