*/ use HasFactory; protected $fillable = [ 'name', 'server_id', 'type', 'protocol', 'port', 'source', 'mask', 'note', 'status', ]; protected $casts = [ 'server_id' => 'integer', 'port' => 'integer', ]; public function getStatusColor(): string { return match ($this->status) { FirewallRuleStatus::CREATING, FirewallRuleStatus::UPDATING, FirewallRuleStatus::DELETING => 'warning', FirewallRuleStatus::READY => 'success', FirewallRuleStatus::FAILED => 'danger', default => 'secondary', }; } /** * @return BelongsTo */ public function server(): BelongsTo { return $this->belongsTo(Server::class); } }