This commit is contained in:
Bozhidar 2024-04-30 17:27:45 +03:00
parent a6c5017eb2
commit 411afd45b3
2 changed files with 17 additions and 0 deletions

View file

@ -300,6 +300,10 @@ class DomainResource extends Resource
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('domain_root')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('hostingSubscription.customer.name') Tables\Columns\TextColumn::make('hostingSubscription.customer.name')
->searchable() ->searchable()
->sortable(), ->sortable(),

View file

@ -120,6 +120,19 @@ class Domain extends Model
throw new \Exception('Hosting plan not found'); 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)) { if (!is_dir($this->domain_root)) {
mkdir($this->domain_root, 0711, true); mkdir($this->domain_root, 0711, true);
} }