erp/app/Models/Goods.php

36 lines
574 B
PHP
Raw Normal View History

<?php
namespace App\Models;
2022-07-28 13:46:08 +08:00
use App\Models\traits\Filter;
class Goods extends Model
{
2022-07-28 13:46:08 +08:00
use Filter;
2022-07-28 16:06:15 +08:00
//查询字段
public $fieldSearchable = [
2022-07-28 17:08:05 +08:00
'goods_title',
2022-07-28 16:06:15 +08:00
'type_id',
'brand_id',
];
2022-07-28 13:46:08 +08:00
/**
* 多规格
*/
public function skus()
{
return $this->hasMany(GoodsSku::class, 'goods_id');
}
public function brand()
{
return $this->hasOne(GoodsBrand::class, 'id', 'brand_id');
}
2022-07-28 13:46:08 +08:00
public function type()
{
return $this->hasOne(GoodsType::class, 'id', 'type_id');
}
}