You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;use Illuminate\Database\Eloquent\SoftDeletes;use Illuminate\Database\Eloquent\Model;
class Goods extends Model{ use HasDateTimeFormatter; use SoftDeletes;
protected $table = 'lanzu_goods'; protected $dateFormat = 'U'; protected $appends = [ 'cover_img_url', ];
public function getCoverImgUrlAttribute($value) { $value = $value ? $value : $this->cover_img; return $this->imageUrl($value); } // 处理图片
public function imageUrl($value) { if(strripos($value,"http") === false){ return env('OSS_IMG_HOST').'/'.$value; }else{ return $value; } }}
|