wesmiler 3 месяцев назад
Родитель
Сommit
8faa293120
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      app/Models/CartModel.php

+ 4 - 2
app/Models/CartModel.php

@@ -38,7 +38,8 @@ class CartModel extends BaseModel
      */
     public function goods()
     {
-        return $this->hasOne(GoodsModel::class, 'id', 'goods_id');
+        return $this->hasOne(GoodsModel::class, 'id', 'goods_id')
+            ->where(['status'=>1,'mark'=>1]);
     }
 
     /**
@@ -48,7 +49,8 @@ class CartModel extends BaseModel
     public function cartGoods()
     {
         return $this->hasMany(CartModel::class, 'store_id', 'store_id')
-            ->with(['goods']);
+            ->with(['goods'])
+            ->where(['status'=>1,'mark'=>1]);
     }
 
     /**