<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "caiwu_zc_t".
 *
 * @property integer $id
 * @property string $record_date
 * @property integer $class_id
 * @property string $title
 * @property string $price
 * @property integer $num
 * @property string $total
 * @property string $note
 * @property string $created_at
 * @property string $updated_at
 */
class CaiwuZcT extends \common\models\Base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'caiwu_zc_t';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['record_date'], 'required'],
            [['record_date', 'created_at', 'updated_at'], 'safe'],
            [['class_id', 'num'], 'integer'],
            [['price', 'total'], 'number'],
            [['note'], 'string'],
            [['title'], 'string', 'max' => 200],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'record_date' => 'Record Date',
            'class_id' => 'Class ID',
            'title' => 'Title',
            'price' => 'Price',
            'num' => 'Num',
            'total' => 'Total',
            'note' => 'Note',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }

    public function getClass()
    {
        return $this->hasOne(CaiwuClassT::className(),['id'=>'class_id']);
    }
}
