| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\common\model\shops;
- use app\common\model\BaseModel;
- /**
- * ShopGoods模型
- * Class ShopGoods
- * @package app\common\model\shops
- */
- class ShopGoods extends BaseModel
- {
-
- protected $name = 'shop_goods';
- protected $type = [
- 'goods_category_ids' => 'array',
- 'goods_banners' => 'array',
- 'custom_attribute_items' => 'array'
- ];
- public function goodsCategory()
- {
- return $this->hasOne(ShopCategory::class, 'id', 'goods_category_id')
- ->field('id,name,picture');
- }
- public function goodSpecsInventory()
- {
- return $this->hasMany(ShopGoodSpecsInventory::class, 'shop_goods_id', 'id');
- }
- }
|