Enhance service detail page with type-specific sections and provisioning info

Add service-type-specific detail cards (VPS, Dedicated, Game, Web Hosting),
provisioning info accessor that filters sensitive credentials, and improved
sidebar with service overview and quick actions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Claude Dev
2026-02-09 20:30:12 -05:00
parent f87de9e2a4
commit c82ee91b9a
3 changed files with 749 additions and 40 deletions

View File

@@ -33,6 +33,24 @@ class Service extends Model
'auto_renew',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'credentials',
];
/**
* The accessors to append to the model's array form.
*
* @var list<string>
*/
protected $appends = [
'provisioning_info',
];
protected function casts(): array
{
return [
@@ -73,4 +91,37 @@ class Service extends Model
{
return $this->status === 'active';
}
/**
* Get safe provisioning info excluding sensitive fields like passwords and keys.
*
* @return array<string, mixed>|null
*/
public function getProvisioningInfoAttribute(): ?array
{
$credentials = $this->credentials;
if (! is_array($credentials) || empty($credentials)) {
return null;
}
$sensitiveKeys = [
'password',
'secret',
'token',
'api_key',
'api_secret',
'private_key',
'ssh_key',
'ssh_password',
'root_password',
'admin_password',
'database_password',
'ftp_password',
];
return collect($credentials)
->reject(fn (mixed $value, string $key): bool => in_array(strtolower($key), $sensitiveKeys, true))
->toArray();
}
}