<?php

namespace app\common\model;

use think\Model;

class Train extends Model
{
    // 设置字段信息
    protected $schema = [
        'id'          => 'int',
        'title'       => 'string',
        'contact'     => 'string',
        'mobile'      => 'string',
        'address'     => 'string',
        'create_time' => 'int',
        'priority'    => 'int',
    ];

    // 设置字段自动转换类型
    protected $type = [
        'create_time' => 'timestamp:Y-m-d H:i',
    ];

    public function getStatusTextAttr($value, $data)
    {
        $status = [1 => '显示', 2 => '隐藏'];
        return $status[$data['status']];
    }
}