ServiceStatus::class, 'category' => ServiceCategory::class, 'type' => ServiceType::class, 'deploy_policy' => DeployPolicy::class, 'process_roles' => 'array', 'default_cpu_limit' => 'decimal:3', 'config' => 'array', 'credentials' => 'encrypted:array', ]; } public function folderName(): Attribute { return new Attribute( get: fn () => $this->name.'-'.$this->id, ); } public function server(): BelongsTo { return $this->belongsTo(Server::class); } public function organisation(): BelongsTo { return $this->belongsTo(Organisation::class); } public function environment(): BelongsTo { return $this->belongsTo(Environment::class); } public function replicas(): HasMany { return $this->hasMany(ServiceReplica::class); } public function slices(): HasMany { return $this->hasMany(ServiceSlice::class); } public function endpoints(): HasMany { return $this->hasMany(ServiceEndpoint::class); } public function operations(): MorphMany { return $this->morphMany(Operation::class, 'target'); } public function driver(): Driver { [$driverType, $versionTrack] = array_pad(explode('.', $this->driver_name, 2), 2, null); $class = config('keystone.drivers')[$driverType][$versionTrack] ?? null; if (! class_exists($class)) { throw new \Exception("Driver class {$class} not found"); } $driver = new $class( containerName: $this->container_name, containerId: $this->container_id, service: $this, ); if ($driver instanceof DatabaseDriver) { $driver->credentials = $this->credentials; } return $driver; } }