66 lines
1.2 KiB
PHP
66 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace app\common\model;
|
||
|
|
|
||
|
|
use support\Model;
|
||
|
|
|
||
|
|
class MessageUserStatus extends Model
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* The connection name for the model.
|
||
|
|
*
|
||
|
|
* @var string|null
|
||
|
|
*/
|
||
|
|
protected $connection = 'mysql';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The table associated with the model.
|
||
|
|
*
|
||
|
|
* @var string
|
||
|
|
*/
|
||
|
|
protected $table = 'message_user_status';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The primary key associated with the table.
|
||
|
|
*
|
||
|
|
* @var string
|
||
|
|
*/
|
||
|
|
protected $primaryKey = 'id';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Indicates if the model should be timestamped.
|
||
|
|
*
|
||
|
|
* @var bool
|
||
|
|
*/
|
||
|
|
public $timestamps = false;
|
||
|
|
|
||
|
|
|
||
|
|
// protected $dateFormat = 'U';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 允许自动填充模型字段
|
||
|
|
*/
|
||
|
|
protected $fillable = ['id', 'msg_id', 'uid', 'status', 'read_at'];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 不允许自动填充模型字段
|
||
|
|
*/
|
||
|
|
protected $guarded = [];
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 关联消息 (多对一)
|
||
|
|
*/
|
||
|
|
public function message()
|
||
|
|
{
|
||
|
|
return $this->belongsTo(MessageNotifications::class, 'msg_id', 'id');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 关联用户 (假设你有 User 模型)
|
||
|
|
*/
|
||
|
|
public function user()
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class, 'uid', 'id');
|
||
|
|
}
|
||
|
|
}
|