<?php

namespace app\common\model;

class FeedbackModel extends BaseModel
{
    // 设置表名
    protected $name = 'feedback';

    //自动完成
    protected $autoWriteTimestamp = true;

    // 常量
    const STATUS = [1 => '已读', 2 => '未读'];

    const STATUS_READ  = 1;
    const STATUS_UNREAD = 2;

    public function getStatusTextAttr($value, $data)
    {
        return self::STATUS[$data['status']];
    }

    public function User()
    {
        return $this->hasMany(UserModel::class, "id", "user_id");
    }

}