resource->type()) { case 'application': $persistentStorages = $this->resource?->persistentStorages()?->get(); StopApplication::run($this->resource, previewDeployments: true); break; case 'standalone-postgresql': case 'standalone-redis': case 'standalone-mongodb': case 'standalone-mysql': case 'standalone-mariadb': case 'standalone-keydb': case 'standalone-dragonfly': case 'standalone-clickhouse': $persistentStorages = $this->resource?->persistentStorages()?->get(); StopDatabase::run($this->resource); break; case 'service': StopService::run($this->resource); DeleteService::run($this->resource, $this->deleteConfigurations, $this->deleteVolumes, $this->deleteImages, $this->deleteConnectedNetworks); break; } if ($this->deleteConfigurations) { $this->resource?->delete_configurations(); } if ($this->deleteVolumes && $this->resource->type() !== 'service') { $this->resource?->delete_volumes($persistentStorages); } $server = data_get($this->resource, 'server'); if ($this->deleteImages && $server) { CleanupDocker::run($server, true); } if ($this->deleteConnectedNetworks) { $uuid = $this->resource->uuid; // Get the UUID from the resource $this->resource?->delete_connected_networks($uuid); // Pass the UUID to the method } } catch (\Throwable $e) { send_internal_notification('ContainerStoppingJob failed with: ' . $e->getMessage()); throw $e; } finally { $this->resource->forceDelete(); Artisan::queue('cleanup:stucked-resources'); } } }