Browse Source

添加图片域名判断

master
Mike 5 years ago
parent
commit
c9b17cdb80
  1. 8
      app/Models/LanzuGoods.php

8
app/Models/LanzuGoods.php

@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;
use Illuminate\Support\Str;
class LanzuGoods extends Model
{
@ -12,6 +13,13 @@ class LanzuGoods extends Model
protected $table = 'lanzu_goods';
protected $dateFormat = 'U';
public function getCoverImgAttribute($v){
if(Str::startsWith($v,"http")){
return $v;
}else{
return env('IMG_HOST') . $v;
}
}
public function searchableAs()
{

Loading…
Cancel
Save