diff --git a/app/Model/v3/Goods.php b/app/Model/v3/Goods.php index 452d025..1e6a60e 100644 --- a/app/Model/v3/Goods.php +++ b/app/Model/v3/Goods.php @@ -133,4 +133,19 @@ class Goods extends Model return $this->morphMany(ShoppingCart::class, 'goods'); } + public function setSpecAttribute($value) + { + $this->attributes['spec'] = json_encode($value); + } + + public function setTagsAttribute($value) + { + $this->attributes['tags'] = json_encode($value); + } + + public function setDetailsImgsAttribute($value) + { + $this->attributes['details_imgs'] = json_encode($value); + } + } \ No newline at end of file diff --git a/app/Model/v3/GoodsActivity.php b/app/Model/v3/GoodsActivity.php index 4eea067..497a6da 100644 --- a/app/Model/v3/GoodsActivity.php +++ b/app/Model/v3/GoodsActivity.php @@ -99,4 +99,19 @@ class GoodsActivity extends Model { return $this->morphMany(ShoppingCart::class, 'goods'); } + + public function setSpecAttribute($value) + { + $this->attributes['spec'] = json_encode($value); + } + + public function setTagsAttribute($value) + { + $this->attributes['tags'] = json_encode($value); + } + + public function setDetailsImgsAttribute($value) + { + $this->attributes['details_imgs'] = json_encode($value); + } } \ No newline at end of file diff --git a/app/Model/v3/OrderGoods.php b/app/Model/v3/OrderGoods.php index b8290d0..b1e1035 100644 --- a/app/Model/v3/OrderGoods.php +++ b/app/Model/v3/OrderGoods.php @@ -52,4 +52,14 @@ class OrderGoods extends Model { return Goods::query()->where(['id' => $this->attributes['goods_id']])->value('tags'); } + + public function setSpecAttribute($value) + { + $this->attributes['spec'] = json_encode($value); + } + + public function setTagsAttribute($value) + { + $this->attributes['tags'] = json_encode($value); + } } \ No newline at end of file