| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace common\models;
- /**
- * This is the model class for table "xhCart".
- *
- * @property integer $id
- * @property integer $userId
- * @property integer $merchantId
- * @property integer $goodsId
- * @property integer $num
- * @property string $createTime
- * @property string $updateTime
- */
- class xhCart extends xhBaseModel
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'xhCart';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['userId', 'merchantId', 'goodsId', 'num', 'goodsPriceId'], 'integer'],
- [['createTime'], 'required'],
- [['createTime', 'updateTime'], 'safe'],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'userId' => 'User ID',
- 'merchantId' => 'Merchant ID',
- 'goodsId' => 'Goods ID',
- 'goodsPriceId' => 'Goods Price Id',
- 'num' => 'Num',
- 'createTime' => 'Create Time',
- 'updateTime' => 'Update Time',
- ];
- }
-
- public function getXhGoods()
- {
- // 关系和商品通过 Goods.id -> goodsId 关联建立一对一关系
- return $this->hasOne(xhGoods::className(), ['id' => 'goodsId']);
- }
-
- }
|