ran pint
This commit is contained in:
@@ -36,21 +36,21 @@ class FirewallRule extends Model
|
||||
|
||||
public function command(bool $delete = false): string
|
||||
{
|
||||
$command = "ufw";
|
||||
$command = 'ufw';
|
||||
|
||||
if ($delete) {
|
||||
$command .= " delete";
|
||||
$command .= ' delete';
|
||||
}
|
||||
|
||||
if ($this->type === 'allow') {
|
||||
$command .= " allow";
|
||||
$command .= ' allow';
|
||||
} elseif ($this->type === 'deny') {
|
||||
$command .= " deny";
|
||||
$command .= ' deny';
|
||||
}
|
||||
|
||||
if ($this->from) {
|
||||
$command .= " from {$this->from}";
|
||||
$command .= " to any port";
|
||||
$command .= ' to any port';
|
||||
}
|
||||
|
||||
$command .= " {$this->ports}";
|
||||
|
||||
@@ -29,7 +29,7 @@ class Network extends Model
|
||||
{
|
||||
return $this->hasMany(Server::class, 'external_network_id');
|
||||
}
|
||||
|
||||
|
||||
public function organisation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Organisation::class);
|
||||
|
||||
@@ -45,8 +45,9 @@ class Organisation extends Model
|
||||
$slug = Str::slug($name);
|
||||
$count = 2;
|
||||
while (Organisation::where('slug', $slug)->exists()) {
|
||||
$slug = Str::slug($name) . '-' . $count++;
|
||||
$slug = Str::slug($name).'-'.$count++;
|
||||
}
|
||||
|
||||
return $slug;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ class Server extends Model
|
||||
$existingServer = Server::whereOrganisationId($server->organisation_id)
|
||||
->orderByDesc('internal_ip_ending')
|
||||
->first();
|
||||
|
||||
|
||||
$server->internal_ip_ending = $existingServer
|
||||
? $existingServer->internal_ip_ending + 1
|
||||
: 2;
|
||||
$server->internal_ip = config('keystone.internal_ip_base') . $server->internal_ip_ending;
|
||||
$server->internal_ip = config('keystone.internal_ip_base').$server->internal_ip_ending;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class Server extends Model
|
||||
{
|
||||
return $this->belongsTo(Network::class, 'external_network_id');
|
||||
}
|
||||
|
||||
|
||||
public function internalNetwork(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Network::class, 'internal_network_id');
|
||||
|
||||
@@ -41,12 +41,12 @@ class Service extends Model
|
||||
|
||||
public function driver(
|
||||
?string $defaultPassword = null,
|
||||
): Driver
|
||||
{
|
||||
): Driver {
|
||||
$class = config("keystone.drivers.{$this->driver_name}");
|
||||
if (!class_exists($class)) {
|
||||
if (! class_exists($class)) {
|
||||
throw new \Exception("Driver class {$class} not found");
|
||||
}
|
||||
|
||||
return new $class($this->container_name, $this->container_id, defaultPassword: $defaultPassword);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user