Skip to content

Commit 0005ab0

Browse files
committed
delete all subdomains on cloudflare when uninstalling plugin
1 parent bf8b3ea commit 0005ab0

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

subdomains/database/migrations/002_create_subdomains_table.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use Boy132\Subdomains\Models\Subdomain;
34
use Illuminate\Database\Migrations\Migration;
45
use Illuminate\Database\Schema\Blueprint;
56
use Illuminate\Support\Facades\Schema;
@@ -28,6 +29,13 @@ public function up(): void
2829

2930
public function down(): void
3031
{
32+
Subdomain::all()->each(function (Subdomain $subdomain) {
33+
try {
34+
$subdomain->delete();
35+
} catch (Exception) {
36+
}
37+
});
38+
3139
Schema::dropIfExists('subdomains');
3240
}
3341
};

0 commit comments

Comments
 (0)