🛠️ Add anon column to self-hosted services: Update views, models, forms, and migrations to support anonymous service creation and display

This commit is contained in:
HolgerHatGarKeineNode
2025-12-07 06:16:47 +01:00
parent 9ee7ef1771
commit c4cea2ae7a
4 changed files with 36 additions and 6 deletions

View File

@@ -73,7 +73,7 @@ class ServiceForm extends Form
$this->ip = $service->ip;
$this->type = $service->type?->value;
$this->contact = $service->contact;
$this->anonymous = is_null($service->created_by);
$this->anonymous = $service->anon;
}
public function store(): SelfHostedService
@@ -91,7 +91,8 @@ class ServiceForm extends Form
'url_pkdns' => $this->url_pkdns,
'ip' => $this->ip,
'contact' => $this->contact,
'created_by' => $this->anonymous ? null : auth()->id(),
'anon' => $this->anonymous,
'created_by' => auth()->id(),
]);
}
@@ -110,7 +111,7 @@ class ServiceForm extends Form
'url_pkdns' => $this->url_pkdns,
'ip' => $this->ip,
'contact' => $this->contact,
'created_by' => $this->anonymous ? null : ($this->service->created_by ?? auth()->id()),
'anon' => $this->anonymous,
]);
}

View File

@@ -28,6 +28,7 @@ class SelfHostedService extends Model implements HasMedia
'id' => 'integer',
'created_by' => 'integer',
'type' => SelfHostedServiceType::class,
'anon' => 'boolean',
];
protected static function booted(): void