<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "brand_t".
 *
 * @property integer $id
 * @property string $name
 * @property string $created_at
 * @property string $updated_at
 */
class MeetT extends \common\models\Base
{
    
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'car_meet';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name'], 'required'],
            [['created_at', 'updated_at'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'code' => 'Code',
            'name' => 'Name',
            'state' => 'State',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }
    
    //返回全部信息
    static public function getAllData($mtype=0){
        
        $list = self::find()
            ->where('state = 1 and mtype ='.$mtype)
            ->orderBy('id ASC')
            ->all();
        
        return $list;
    }
    
    public function getShowName()
    {
        return $this->name;
    }
    
    public function getShowType()
    {
        switch($this->mtype){
        case 1:
          $type = '新保(续保)组';
          break;  
        case 2:
          $type = '跟踪组';
          break;
        default:
          $type = '(未选择)';
        }
        return $type;
    }

}