diff --git a/app/Http/Controllers/Admin/OrdersController.php b/app/Http/Controllers/Admin/OrdersController.php index 7368585..546ea40 100755 --- a/app/Http/Controllers/Admin/OrdersController.php +++ b/app/Http/Controllers/Admin/OrdersController.php @@ -245,7 +245,10 @@ class OrdersController extends CommonController }])->orderBy("building.myindex") ->orderBy("area.myindex") ->select("area.id", "area.name", "area.building_id", "area.project_id") - ->where('beds_count','>',0) + ->addSelect([ + 'total' => Bed::whereColumn('area_id', 'area.id')->selectRaw('count(1) as beds_count'), + ]) + //->where('beds_count','>',0) ->leftJoin("building", "area.building_id", "=", "building.id") ->addSelect("building.name as building_name") ->withCount("beds")