We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6e80392 commit b906a72Copy full SHA for b906a72
1 file changed
subdomains/src/Models/Subdomain.php
@@ -62,6 +62,18 @@ public function upsertOnCloudflare(): void
62
throw new Exception('Server has no allocation');
63
}
64
65
+ $response = Http::cloudflare()->get("zones/{$this->domain->cloudflare_id}/dns_records/$this->cloudflare_id", ['search' => $this->name])->json();
66
+
67
+ if ($response['success']) {
68
+ if (!empty($response['result'])) {
69
+ throw new Exception('A subdomain with that name already exists');
70
+ }
71
+ } else {
72
+ if ($response['errors'] && count($response['errors']) > 0) {
73
+ throw new Exception($response['errors'][0]['message']);
74
75
76
77
$payload = [
78
'name' => $this->name,
79
'type' => $this->record_type,
0 commit comments