'array', ]; public static $_COVER_TYPE = [1=>'图片', 2=>'视频']; public static $_PATH_TYPE = ['page'=>'page','webview'=>'webview','applet'=>'applet']; public static $_TYPE = [1=>'首页']; public static $_STATUS = ['禁用', '正常']; public function getCoverUrlAttribute($value) { $value = $value ? $value : $this->cover; return $this->imageUrl($value); } public function getCoverTypeTextAttribute($value) { $value = $value ? $value : $this->cover_type; return isset(self::$_COVER_TYPE[$value]) ? self::$_COVER_TYPE[$value] : ''; } public function getPathTypeTextAttribute($value) { $value = $value ? $value : $this->path_type; return isset(self::$_PATH_TYPE[$value]) ? self::$_PATH_TYPE[$value] : ''; } public function getTypeTextAttribute($value) { $value = $value ? $value : $this->type; return isset(self::$_TYPE[$value]) ? self::$_TYPE[$value] : ''; } public function getStatusTextAttribute($value) { $value = $value ? $value : $this->stauts; return isset(self::$_STATUS[$value]) ? self::$_STATUS[$value] : ''; } /** * 处理旧图片 * @param $value * @return string */ public function imageUrl($value) { if(strripos($value,"http") === false){ return config('filesystems.disks.oss.img_host').'/'.$value; }else{ return $value; } } }