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 Illuminate\Database\Eloquent\Model;use Laravel\Scout\Searchable;use Illuminate\Support\Str;
class LanzuGoods extends Model{ use Searchable;
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() { return 'lanzu-goods-test'; }
public function toSearchableArray() { return [ 'name' => $this->name, 'market_id' => $this->market_id, 'store_id' => $this->store_id, ]; }
/** * 指定 搜索索引中存储的唯一ID * @return mixed */ public function getScoutKey() { return $this->id; }
/** * 指定 搜索索引中存储的唯一ID的键名 * @return string */ public function getScoutKeyName() { return 'id'; }
}
|