Add model-level hidden fields for secrets, tokens, keys, notification credentials, deployment logs, and environment values. Allow explicit read:sensitive API access to reveal gated private keys and deployment logs, and cover the behavior with feature and unit tests.
53 lines
1 KiB
PHP
53 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class SslCertificate extends Model
|
|
{
|
|
protected $fillable = [
|
|
'ssl_certificate',
|
|
'ssl_private_key',
|
|
'configuration_dir',
|
|
'mount_path',
|
|
'resource_type',
|
|
'resource_id',
|
|
'server_id',
|
|
'common_name',
|
|
'subject_alternative_names',
|
|
'valid_until',
|
|
'is_ca_certificate',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'ssl_private_key',
|
|
];
|
|
|
|
protected $casts = [
|
|
'ssl_certificate' => 'encrypted',
|
|
'ssl_private_key' => 'encrypted',
|
|
'subject_alternative_names' => 'array',
|
|
'valid_until' => 'datetime',
|
|
];
|
|
|
|
public function application()
|
|
{
|
|
return $this->morphTo('resource');
|
|
}
|
|
|
|
public function service()
|
|
{
|
|
return $this->morphTo('resource');
|
|
}
|
|
|
|
public function database()
|
|
{
|
|
return $this->morphTo('resource');
|
|
}
|
|
|
|
public function server()
|
|
{
|
|
return $this->belongsTo(Server::class);
|
|
}
|
|
}
|