zilong před 4 roky
rodič
revize
d40a8e3f24
1 změnil soubory, kde provedl 7 přidání a 2 odebrání
  1. 7 2
      app/Models/DocterMessage.php

+ 7 - 2
app/Models/DocterMessage.php

xqd
@@ -18,14 +18,19 @@ class DocterMessage extends BaseModel
             $content = config('config.docter_message_map')[$type] ?? '';
             $content = vsprintf($content, $param);
         }
-        DocterMessage::create([
+        $add = [
             'docter_id' => $docter_id,
             'status' => 1,
             'user_id' => $user_id,
             'type' => $type,
             'relation_id' => $relation_id,
             'content' => $content,
-        ]);
+        ];
+        if (in_array($type, [1,4])) {
+            $product_type = Order::where('id', $relation_id)->value('product_type');
+            $add['order_type'] = $product_type;
+        }
+        DocterMessage::create($add);
 
         return true;
     }