UserInvitation.php 580 字节
<?php


namespace app\api\model;


use think\Model;

class UserInvitation extends Model
{
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    protected $createTime = 'createtime';
    protected $updateTime = '';
    protected $append = [
        'createtime_text'
    ];

    public function getCreatetimeTextAttr($value,$data)
    {
        $value = !empty($data['createtime']) ? date('Y/m/d',$data['createtime']) : '';
        return $value;
    }

    public function user()
    {
        return $this->belongsTo('User','to_user_id','id');
    }
}