审查视图

application/api/model/UserInvitation.php 580 字节
李忠强 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<?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');
    }
}