mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 14:40:44 +00:00
36 lines
574 B
PHP
36 lines
574 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\traits\Filter;
|
|
|
|
class Goods extends Model
|
|
{
|
|
use Filter;
|
|
|
|
//查询字段
|
|
public $fieldSearchable = [
|
|
'goods_title',
|
|
'type_id',
|
|
'brand_id',
|
|
];
|
|
|
|
/**
|
|
* 多规格
|
|
*/
|
|
public function skus()
|
|
{
|
|
return $this->hasMany(GoodsSku::class, 'goods_id');
|
|
}
|
|
|
|
public function brand()
|
|
{
|
|
return $this->hasOne(GoodsBrand::class, 'id', 'brand_id');
|
|
}
|
|
|
|
public function type()
|
|
{
|
|
return $this->hasOne(GoodsType::class, 'id', 'type_id');
|
|
}
|
|
}
|