*/ use HasFactory; public const string RESOURCE_NAME = 'server_transfer'; /** * @return array */ protected function casts(): array { return [ 'server_id' => 'int', 'old_node' => 'int', 'new_node' => 'int', 'old_allocation' => 'int', 'new_allocation' => 'int', 'old_additional_allocations' => 'array', 'new_additional_allocations' => 'array', 'successful' => 'bool', 'archived' => 'bool', ]; } /** * @return BelongsTo */ public function server(): BelongsTo { return $this->belongsTo(Server::class); } /** * @return HasOne */ public function oldNode(): HasOne { return $this->hasOne(Node::class, 'id', 'old_node'); } /** * @return HasOne */ public function newNode(): HasOne { return $this->hasOne(Node::class, 'id', 'new_node'); } }