get(); throw_if($hosts->isEmpty(), new NoSuitableDatabaseHostException()); $nodeHosts = $server->node->databaseHosts()->get(); // TODO: @areyouscared remove allow random feature for database hosts throw_if($nodeHosts->isEmpty() && !config('panel.client_features.databases.allow_random'), new NoSuitableDatabaseHostException()); return $this->managementService->create($server, [ 'database_host_id' => $nodeHosts->isEmpty() ? $hosts->random()->id : $nodeHosts->random()->id, 'database' => DatabaseManagementService::generateUniqueDatabaseName($data['database'], $server->id), 'remote' => $data['remote'], ]); } }