<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "caiwu_gift_t".
 *
 * @property integer $id
 * @property integer $year
 * @property integer $month
 * @property integer $gift_id
 * @property string $price
 * @property string $created_at
 * @property string $updated_at
 */
class CaiwuGiftT extends \common\models\Base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'caiwu_gift_t';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['year', 'month', 'gift_id', 'price'], 'required'],
            [['year', 'month', 'gift_id'], 'integer'],
            [['price'], 'number'],
            [['created_at', 'updated_at'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'year' => 'Year',
            'month' => 'Month',
            'gift_id' => 'Gift ID',
            'price' => 'Price',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }

    public function getGift()
    {
        return $this->hasOne(GiftType3T::className(),['id'=>'gift_id']);
    }
}
