wip: services

This commit is contained in:
Andras Bacsai
2023-09-20 15:42:41 +02:00
parent a86e971020
commit b4d69a22df
32 changed files with 964 additions and 222 deletions

View File

@@ -33,12 +33,14 @@ class EnvironmentVariable extends Model
}
});
}
public function service() {
return $this->belongsTo(Service::class);
}
protected function value(): Attribute
{
return Attribute::make(
get: fn (string $value) => $this->get_environment_variables($value),
set: fn (string $value) => $this->set_environment_variables($value),
get: fn (?string $value = null) => $this->get_environment_variables($value),
set: fn (?string $value = null) => $this->set_environment_variables($value),
);
}
@@ -57,8 +59,11 @@ class EnvironmentVariable extends Model
return $environment_variable;
}
private function set_environment_variables(string $environment_variable): string|null
private function set_environment_variables(?string $environment_variable = null): string|null
{
if (is_null($environment_variable) && $environment_variable == '') {
return null;
}
$environment_variable = trim($environment_variable);
return encrypt($environment_variable);
}
@@ -69,4 +74,5 @@ class EnvironmentVariable extends Model
set: fn (string $value) => Str::of($value)->trim(),
);
}
}