From 411afd45b35f94e82df6d0a876428a9f773887fb Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Tue, 30 Apr 2024 17:27:45 +0300 Subject: [PATCH] update --- web/app/Filament/Resources/DomainResource.php | 4 ++++ web/app/Models/Domain.php | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/web/app/Filament/Resources/DomainResource.php b/web/app/Filament/Resources/DomainResource.php index 8a73aca..31a23d7 100644 --- a/web/app/Filament/Resources/DomainResource.php +++ b/web/app/Filament/Resources/DomainResource.php @@ -300,6 +300,10 @@ class DomainResource extends Resource ->searchable() ->sortable(), + Tables\Columns\TextColumn::make('domain_root') + ->searchable() + ->sortable(), + Tables\Columns\TextColumn::make('hostingSubscription.customer.name') ->searchable() ->sortable(), diff --git a/web/app/Models/Domain.php b/web/app/Models/Domain.php index 903446b..92322d7 100644 --- a/web/app/Models/Domain.php +++ b/web/app/Models/Domain.php @@ -120,6 +120,19 @@ class Domain extends Model throw new \Exception('Hosting plan not found'); } + if (empty($this->domain_root)) { + if ($this->is_main == 1) { + $this->domain_root = '/home/'.$findHostingSubscription->system_username; + $this->domain_public = '/home/'.$findHostingSubscription->system_username.'/public_html'; + $this->home_root = '/home/'.$findHostingSubscription->system_username; + } else { + $this->domain_root = '/home/'.$findHostingSubscription->system_username.'/domains/'.$this->domain; + $this->domain_public = $this->domain_root.'/public_html'; + $this->home_root = '/home/'.$findHostingSubscription->system_username; + } + $this->save(); + } + if (!is_dir($this->domain_root)) { mkdir($this->domain_root, 0711, true); }