Browse Source

修改器

master
weigang 5 years ago
parent
commit
f32c8588f3
  1. 15
      app/Model/v3/Goods.php
  2. 15
      app/Model/v3/GoodsActivity.php
  3. 10
      app/Model/v3/OrderGoods.php

15
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);
}
}

15
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);
}
}

10
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);
}
}
Loading…
Cancel
Save