2022-07-26 20:05:14 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2022-07-28 13:46:08 +08:00
|
|
|
use App\Models\traits\Filter;
|
|
|
|
|
|
2022-07-26 20:05:14 +08:00
|
|
|
class Goods extends Model
|
|
|
|
|
{
|
2022-07-28 13:46:08 +08:00
|
|
|
use Filter;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 多规格
|
|
|
|
|
*/
|
|
|
|
|
public function skus()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(GoodsSku::class, 'goods_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function brand()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasOne(GoodsBrand::class, 'id', 'brand_id');
|
|
|
|
|
}
|
2022-07-26 20:05:14 +08:00
|
|
|
|
2022-07-28 13:46:08 +08:00
|
|
|
public function type()
|
|
|
|
|
{
|
|
|
|
|
return $this->hasOne(GoodsType::class, 'id', 'type_id');
|
|
|
|
|
}
|
2022-07-26 20:05:14 +08:00
|
|
|
}
|