'datetime', 'last_seen_at' => 'datetime', ]; public function hosts(): HasMany { return $this->hasMany(NetworkHost::class, 'device_id'); } public function events(): HasMany { return $this->hasMany(NetworkDeviceEvent::class, 'device_id')->latest(); } public function getDisplayNameAttribute(): string { return $this->label ?? $this->hostname ?? $this->current_ip ?? $this->mac_address; } public function getStatusColorAttribute(): string { return match($this->status) { 'online' => 'green', 'offline' => 'red', default => 'gray', }; } }