wip: services
This commit is contained in:
@@ -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(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user