diff --git a/app/Http/Controllers/Manager/StatisticsController.php b/app/Http/Controllers/Manager/StatisticsController.php index 9218d0c..6841254 100644 --- a/app/Http/Controllers/Manager/StatisticsController.php +++ b/app/Http/Controllers/Manager/StatisticsController.php @@ -222,7 +222,22 @@ class StatisticsController extends CommonController $model_recharge = Recharge::whereHas("order", function ($query) use ($request) { $query->where("project_id", $request->project_id); - })->whereNotNull("paid_at")->whereRaw("UNIX_TIMESTAMP(`paid_at`) between {$from_date_timestamp} and {$to_date_timestamp}"); + })->whereNotNull("paid_at") + ->with(['order' => function ($query) { + $query->with([ + "orderItems", + "firstItem", + "lastItem", + "project", + "product", + "customer", + "manager", + "bed" => function ($query) { + $query->with(["room", "building"]); + } + ]); + }])->whereRaw("UNIX_TIMESTAMP(`paid_at`) between {$from_date_timestamp} and {$to_date_timestamp}"); + $model_refund = Refund::whereHas("order", function ($query) use ($request) { $query->where("project_id", $request->project_id); })->whereNotNull("paid_at")->whereRaw("UNIX_TIMESTAMP(`paid_at`) between {$from_date_timestamp} and {$to_date_timestamp}"); @@ -290,7 +305,6 @@ class StatisticsController extends CommonController $new_order_total = Orders::whereBetween('created_at', [$from_date, $to_date]) ->where("project_id", $request->project_id) ->count(); - return response()->json(compact( "checkout", "refund", "recharge", "payment_methods", diff --git a/public/h5/index.html b/public/h5/index.html index 4dad201..4c8f392 100644 --- a/public/h5/index.html +++ b/public/h5/index.html @@ -1,2 +1,2 @@