<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class DistReadStatus extends Model
{
    use HasFactory;

    protected $table = 'dist_read_status';
    protected $fillable = ['user_id', 'message_id', 'is_read', 'created_at', 'updated_at'];

    // 阅读状态属于一个用户
    public function user()
    {
        return $this->belongsTo(DistAdminDistributor::class, 'user_id');
    }

    // 阅读状态属于一条消息
    public function message()
    {
        return $this->belongsTo(DistMessage::class, 'message_id');
    }
}
