<?php
namespace app\common\model;

use think\Model;

class WorkerForm extends Model
{
	// 设置字段信息
    protected $schema = [
        'id'			=> 'int',
		'workerid'		=> 'int',
		'comname'		=> 'string',
		'address'		=> 'string',
		'details'		=> 'string',
		'realname'		=> 'string',
		'mobile'		=> 'string',
		'comjobs'		=> 'string',
		'status'		=> 'tinyint',
		'remark'		=> 'string',
		'createtime'    => 'int'
    ];
	
	// 设置字段自动转换类型
	protected $type = [
		'createtime'	=> 'timestamp:Y-m-d H:i:s'
    ];
	
	public function getStatusTextAttr($value,$data)
	{
		$status = [1=>'待处理',2=>'处理中',3=>'已处理'];
		return $status[$data['status']];
	}
	
	
	// 关联Worker
	public function worker()
	{
	    return $this->hasOne(Worker::class, "id", "workerid");
	}
	

}