| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use Yii;
- use yii\behaviors\TimestampBehavior;
- /**
- * This is the model class for table "{{%goods_cat}}".
- *
- * @property integer $id
- * @property integer $goods_id
- * @property integer $store_id
- * @property integer $cat_id
- * @property integer $is_delete
- * @property integer $created_at
- * @property integer $updated_at
- */
- class GoodsCat extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%goods_cat}}';
- }
- public function behaviors()
- {
- return [
- [
- // 自动更新创建和更新时间
- 'class' => TimestampBehavior::class,
- 'value' => time()
- ]
- ];
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['goods_id', 'store_id', 'cat_id', 'is_delete'], 'integer'],
- [['is_delete'], 'default', 'value' => 0]
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'goods_id' => 'Goods ID',
- 'store_id' => 'Store ID',
- 'cat_id' => '分类id 多个分类用英文逗号隔开',
- 'is_delete' => 'Is Delete',
- ];
- }
- // 关联商品表
- public function getGoods()
- {
- return $this->hasOne(Goods::className(), ['id'=>'goods_id']);
- }
- public function getCat()
- {
- return $this->hasOne(Cat::className(), ['id' => 'cat_id']);
- }
- }
|