12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace App\Models\Goods;
- use App\Base\BaseModel;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Support\Arr;
- class Goods extends BaseModel
- {
- use SoftDeletes;
- protected $table = "goods";
- const STATUS_OK = 1;
- const STATUS_OFF = 2;
- protected $casts = [
- "image_list" => "array",
- "spec" => "array",
- "custom" => "array",
- ];
- public function format(...$options)
- {
- }
- public function map()
- {
- return $this->hasMany(GoodsCategoryMap::class, "goods_id", "id");
- }
- public function getThumbAttribute()
- {
- return Arr::first($this->image_list);
- }
- public function specMap()
- {
- return $this->hasMany(GoodsSpecMap::class, "goods_id", "id");
- }
- }
|