// +---------------------------------------------------------------------- namespace App\Models; /** * 商品分类管理-模型 * @author laravel开发员 * @since 2020/11/11 * @package App\Models */ class GoodsCategoryModel extends BaseModel { // 设置数据表 protected $table = 'goods_categorys'; protected $appends = ['type_name']; // 封面图 public function getIconAttribute($value) { $thumb = $value ? get_image_url($value) : ''; return $thumb; } public function setIconAttribute($value) { return $value ? get_image_path($value) : ''; } public function getTypeNameAttribute() { $types = ['',1=>'自营品专区',2=>'延时专区',3=>'深度体验',4=>'男神玩具',5=>'女神玩具',6=>'私密养护',7=>'情趣服饰(香水)',8=>'SM房趣(套装)',9=>'体感娃娃',10=>'周边产品']; return isset($types[$this->type]) ? $types[$this->type] : ''; } }