diff --git a/web/app/Actions/ApacheWebsiteCreate.php b/web/app/Actions/ApacheWebsiteCreate.php index d486fc2..bc3e2cc 100644 --- a/web/app/Actions/ApacheWebsiteCreate.php +++ b/web/app/Actions/ApacheWebsiteCreate.php @@ -12,6 +12,7 @@ class ApacheWebsiteCreate public $user; public $email; public $password; + public $isMainDomain = false; public $additionalServices = []; public $features = []; @@ -45,6 +46,11 @@ class ApacheWebsiteCreate $this->features = $features; } + public function setIsMainDomain($isMainDomain) + { + $this->isMainDomain = $isMainDomain; + } + public function handle() { $getLinuxUser = new GetLinuxUser(); @@ -55,10 +61,19 @@ class ApacheWebsiteCreate return false; } - $allDomainsRoot = '/home/'.$this->user.'/domains'; - $domainRoot = '/home/'.$this->user.'/domains/'.$this->domain; - $domainPublic = $domainRoot . '/public_html'; - $homeRoot = '/home/'.$this->user; + if ($this->isMainDomain) { + $allDomainsRoot = '/home/' . $this->user . '/public_html'; + $domainRoot = '/home/' . $this->user; + $domainPublic = '/home/' . $this->user . '/public_html'; + $homeRoot = '/home/' . $this->user; + } else { + $allDomainsRoot = '/home/' . $this->user . '/domains'; + $domainRoot = '/home/' . $this->user . '/domains/' . $this->domain; + $domainPublic = $domainRoot . '/public_html'; + $homeRoot = '/home/' . $this->user; + } + + $apacheVirtualHostConfigs = app()->virtualHostManager->getConfigs($this->additionalServices);