Add dedicated show/edit pages for cloud provider tokens and cloud-init scripts, including descriptions and UUID routes. Generate private keys directly from the index and surface cloud provider API loading errors in server creation flows.
35 lines
638 B
PHP
35 lines
638 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
class CloudInitScript extends BaseModel
|
|
{
|
|
protected $fillable = [
|
|
'team_id',
|
|
'name',
|
|
'script',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'script',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'script' => 'encrypted',
|
|
];
|
|
}
|
|
|
|
public function team()
|
|
{
|
|
return $this->belongsTo(Team::class);
|
|
}
|
|
|
|
public static function ownedByCurrentTeam(array $select = ['*'])
|
|
{
|
|
$selectArray = collect($select)->concat(['id']);
|
|
|
|
return self::whereTeamId(currentTeam()->id)->select($selectArray->all());
|
|
}
|
|
}
|