Browse Source

feat:前端商品分类模型增加beforesave方法,在beforesave中增加filter_attr字段的存储

antshop
linyaostalker 5 years ago
parent
commit
9e2bb06fd8
  1. 8
      backend/modules/goods/models/ars/ShopCategory.php

8
backend/modules/goods/models/ars/ShopCategory.php

@ -120,4 +120,12 @@ class ShopCategory extends \yii\db\ActiveRecord
{ {
return $this->hasOne(File::className(), ['id' => 'icon']); return $this->hasOne(File::className(), ['id' => 'icon']);
} }
public function beforeSave($insert)
{
if ($this->filter_attr != null && is_array($this->filter_attr)) {
$this->filter_attr = implode(',', $this->filter_attr);
}
return parent::beforeSave($insert); // TODO: Change the autogenerated stub
}
} }
Loading…
Cancel
Save