<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "invalid_renewal".
 *
 * @property integer $id
 * @property integer $car_id
 * @property string $car_no
 * @property string $insurer1_date
 * @property string $phone
 * @property string $xdate
 * @property integer $invalid_id
 * @property integer $num
 */
class InvalidRenewal extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'invalid_renewal';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['car_id', 'invalid_id', 'num', 'user_id'], 'integer'],
            [['insurer1_date','insurer2_date'], 'safe'],
            [['car_no', 'phone', 'xdate'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'car_id' => 'Car ID',
            'user_id' => 'User ID',
            'car_no' => 'Car No',
            'insurer1_date' => 'Insurer1 Date',
            'phone' => 'Phone',
            'xdate' => 'Xdate',
            'invalid_id' => 'Invalid ID',
            'num' => 'Num',
        ];
    }
    public function getInvalids()
    {
        return $this->hasOne(InvalidT::className(), ['id' => 'invalid_id']);
    }
    public function getUser()
    {
        return $this->hasOne(UserT::className(),['id'=>'user_id']);
    }
}
