feat: add is shared to env variables

This commit is contained in:
peaklabs-dev committed 2024-10-16 13:20:26 +02:00
1 parent edad4fcd5c
commit b9c9c1041a
2 files changed
+32

No files matched your search

+10
View File
@@ -74,6 +74,9 @@ class EnvironmentVariable extends Model
'version' => config('version'),
]);
});
static::saving(function (EnvironmentVariable $environmentVariable) {
$environmentVariable->updateIsShared();
});
}
public function service()
@@ -217,4 +220,11 @@ class EnvironmentVariable extends Model
set: fn (string $value) => str($value)->trim()->replace(' ', '_')->value,
);
}
protected function updateIsShared(): void
{
$type = str($this->value)->after('{{')->before('.')->value;
$isShared = str($this->value)->startsWith('{{'.$type) && str($this->value)->endsWith('}}');
$this->is_shared = $isShared;
}
}