<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "filtration_t".
 *
 * @property integer $id
 * @property integer $car_id
 * @property integer $user_id
 * @property string $pdate
 * @property string $ptime
 * @property string $xtime
 * @property string $xdate
 * @property integer $ptype
 * @property string $remark
 * @property integer $is_first
 * @property integer $business_group_id
 * @property string $created_at
 * @property string $updated_at
 * @property integer $xbao
 */
class FiltrationT extends \common\models\Base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'filtration_t';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['car_id', 'user_id'], 'required'],
            [['car_id', 'user_id', 'ptype', 'is_first', 'business_group_id', 'xbao','delete_status'], 'integer'],
            [['remark'], 'string'],
            [['created_at', 'updated_at'], 'safe'],
            [['pdate', 'ptime', 'xtime', 'xdate'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'car_id' => 'Car ID',
            'user_id' => 'User ID',
            'pdate' => 'Pdate',
            'ptime' => 'Ptime',
            'xtime' => 'Xtime',
            'xdate' => 'Xdate',
            'ptype' => 'Ptype',
            'remark' => 'Remark',
            'is_first' => 'Is First',
            'business_group_id' => 'Business Group ID',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'xbao' => 'Xbao',
        ];
    }
    public function getCar()
    {
        return $this->hasOne(CarT::className(),['id'=>'car_id']);
    }

    public function getUser()
    {
        return $this->hasOne(UserT::className(),['id'=>'user_id']);
    }
    public function getMeet()
    {
        return $this->hasOne(MeetT::className(),['code'=>'ptype']);
    }
    public function getBusinessGroup()
    {
        return $this->hasOne(BusinessGroupT::className(), ['id' => 'business_group_id']);
    }
}
