<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "express_t".
 *
 * @property integer $id
 * @property integer $car_id
 * @property integer $order_id
 * @property integer $user_id
 * @property integer $ems_company
 * @property string $ems_no
 * @property string $link_name
 * @property string $link_tel
 * @property string $link_address
 * @property string $ems_price
 * @property string $r_price
 * @property string $return_slip
 * @property string $r_date
 * @property string $ems_remark
 * @property string $original_date
 * @property string $send_date
 * @property string $created_at
 * @property string $updated_at
 */
class ExpressT extends \common\models\Base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'express_t';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [[ 'user_id'], 'required'],
            [['car_id', 'order_id', 'user_id', 'ems_company','ex_ad_id','is_order','is_express','physical_no'], 'integer'],
            [['ems_price', 'r_price', 'return_slip'], 'number'],
            [['r_date', 'original_date', 'send_date', 'created_at', 'updated_at'], 'safe'],
            [['ems_no','car_no'], 'string', 'max' => 50],
            [['link_name', 'link_tel'], 'string', 'max' => 20],
            [['link_address', 'ems_remark'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'car_id' => 'Car ID',
            'order_id' => 'Order ID',
            'user_id' => 'User ID',
            'ems_company' => 'Ems Company',
            'ems_no' => 'Ems No',
            'link_name' => 'Link Name',
            'link_tel' => 'Link Tel',
            'link_address' => 'Link Address',
            'ems_price' => 'Ems Price',
            'r_price' => 'R Price',
            'return_slip' => 'Return Slip',
            'r_date' => 'R Date',
            'ems_remark' => 'Ems Remark',
            'original_date' => 'Original Date',
            'send_date' => 'Send Date',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }
    public function getOrder()
    {
        return $this->hasOne(OrderT::className(),['id'=>'order_id']);
    }
    public function getCar()
    {
        return $this->hasOne(CarT::className(),['id'=>'car_id']);
    }
    public function getUser()
    {
        return $this->hasOne(UserT::className(),['id'=>'user_id']);
    }
}
