DistReadStatus.php 620 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class DistReadStatus extends Model
  6. {
  7. use HasFactory;
  8. protected $table = 'dist_read_status';
  9. protected $fillable = ['user_id', 'message_id', 'is_read', 'created_at', 'updated_at'];
  10. // 阅读状态属于一个用户
  11. public function user()
  12. {
  13. return $this->belongsTo(DistAdminDistributor::class, 'user_id');
  14. }
  15. // 阅读状态属于一条消息
  16. public function message()
  17. {
  18. return $this->belongsTo(DistMessage::class, 'message_id');
  19. }
  20. }