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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user