'array', // 'tags'=>'array', 'spec'=>'array', ]; public static $_ONSALE = ['否','是']; public static $_ISINFINITE = ['关闭','开启']; public function getCoverImgUrlAttribute($value) { $value = $value ? $value : $this->cover_img; return $this->imageUrl($value); } public function getOnSaleTextAttribute($value) { $value = $value ? $value : $this->on_sale; return isset(self::$_ONSALE[$value]) ? self::$_ONSALE[$value] : ''; } public function getIsInfiniteTextAttribute($value) { $value = $value ? $value : $this->is_infinite; return isset(self::$_ISINFINITE[$value]) ? self::$_ISINFINITE[$value] : ''; } public function ImageNewBanners(){ return $this->hasMany('\App\Models\v3\GoodsNewBanners','goods_id','id')->where('type',1); } public function VideoNewBanners(){ return $this->hasMany('\App\Models\v3\GoodsNewBanners','goods_id','id')->where('type',2); } /** * 处理旧图片 * @param $value * @return string */ public function imageUrl($value) { if(strripos($value,"http") === false){ return config('filesystems.disks.oss.img_host').'/'.$value; }else{ return $value; } } }