<?php

namespace app\common\model;

use think\Model;

class WorkerIncome extends Model
{
    // 设置字段信息
    protected $schema = [
        'id'           => 'int',
        'workerid'     => 'int',
        'title'        => 'string',
        'origin_value' => 'decimal',
        'value'        => 'decimal',
        'remark'       => 'string',
        'status'       => 'int',
        'createtime'   => 'int',
        'yeartime'     => 'int',
        'monthtime'    => 'int',
    ];

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

    // 关联User
    public function worker()
    {
        return $this->hasOne(Worker::class, "id", "workerid");
    }

}