Person.php 867 字节
<?php

namespace app\admin\model\reservoir\run;

use think\Model;


class Person extends Model
{

    

    

    // 表名
    protected $name = 'reservoir_run_person';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'training_text'
    ];
    

    
    public function getTrainingList()
    {
        return ['1' => __('Training 1'), '2' => __('Training 2')];
    }


    public function getTrainingTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['training']) ? $data['training'] : '');
        $list = $this->getTrainingList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}