*/ use HasFactory; protected $fillable = [ 'server_id', 'load', 'memory_total', 'memory_used', 'memory_free', 'disk_total', 'disk_used', 'disk_free', ]; protected $casts = [ 'server_id' => 'integer', 'load' => 'float', 'memory_total' => 'float', 'memory_used' => 'float', 'memory_free' => 'float', 'disk_total' => 'float', 'disk_used' => 'float', 'disk_free' => 'float', ]; /** * @return BelongsTo */ public function server(): BelongsTo { return $this->belongsTo(Server::class); } public function getMemoryTotalInBytesAttribute(): float|int { return ($this->memory_total ?? 0) * 1024; } public function getMemoryUsedInBytesAttribute(): float|int { return ($this->memory_used ?? 0) * 1024; } public function getMemoryFreeInBytesAttribute(): float|int { return ($this->memory_free ?? 0) * 1024; } public function getDiskTotalInBytesAttribute(): float|int { return ($this->disk_total ?? 0) * (1024 * 1024); } public function getDiskUsedInBytesAttribute(): float|int { return ($this->disk_used ?? 0) * (1024 * 1024); } public function getDiskFreeInBytesAttribute(): float|int { return ($this->disk_free ?? 0) * (1024 * 1024); } }