1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?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");
- }
- }
|