zilong 4 年之前
父节点
当前提交
dd019cccb4
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6 4
      app/Http/Controllers/Api/V1/OrderController.php

+ 6 - 4
app/Http/Controllers/Api/V1/OrderController.php

xqd
@@ -559,11 +559,13 @@ class OrderController extends AuthController
         $user = $this->user;
 
         $data = Order::with(['docter.office', 'docter.qualification', 'orderPatient', 'orderPack', 'orderNurse', 'orderVaccine', 'organization.docter', 'suggest'])->where('id', $req['order_id'])->where('user_id', $user['id'])->first()->toArray();
-        $data['order_pack']['team'] = [];
-        if (!empty($data['order_pack']['team_id'])) {
-            $data['order_pack']['team'] = Team::with(['docter.office', 'docter.qualification'])->whereIn('id', $data['order_pack']['team_id'])->get()->toArray();
+        if (!empty($data['order_pack'])) {
+            $data['order_pack']['team'] = [];
+            if (!empty($data['order_pack']['team_id'])) {
+                $data['order_pack']['team'] = Team::with(['docter.office', 'docter.qualification'])->whereIn('id', $data['order_pack']['team_id'])->get()->toArray();
+            }
         }
-
+        
         return out($data);
     }