'array', 'last_seen_at' => 'datetime', ]; public function room(): BelongsTo { return $this->belongsTo(Room::class); } public function entities(): HasMany { return $this->hasMany(Entity::class); } /** Active and seen recently. */ public function isOnline(): bool { return $this->status === 'active' && $this->last_seen_at !== null && $this->last_seen_at->gt(now()->subMinutes(10)); } }