Update DomainIsCreatedListener.php

This commit is contained in:
Bozhidar 2024-10-10 14:10:47 +03:00
parent c274d89d5f
commit aff951e9d6

View file

@ -11,6 +11,7 @@ use App\Models\HostingSubscription;
use App\Services\HostingSubscriptionService; use App\Services\HostingSubscriptionService;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use MicroweberPackages\SharedServerScripts\MicroweberWhitelabelSettingsUpdater; use MicroweberPackages\SharedServerScripts\MicroweberWhitelabelSettingsUpdater;
use MicroweberPackages\SharedServerScripts\MicroweberWhitelabelWebsiteApply;
use Modules\Microweber\App\Models\MicroweberInstallation; use Modules\Microweber\App\Models\MicroweberInstallation;
class DomainIsCreatedListener class DomainIsCreatedListener
@ -143,12 +144,22 @@ class DomainIsCreatedListener
if (isset($status['success']) && $status['success']) { if (isset($status['success']) && $status['success']) {
$whiteLabelSettings = []; $sharedAppPath = config('microweber.sharedPaths.app');
$whiteLabelSettings['website_manager_url'] = $website_manager_url; // $whitelabelSettings = setting('microweber.whitelabel');
// $whitelabelSettings['website_manager_url'] = setting('microweber.website_manager_url');
//
// $whitelabel = new MicroweberWhitelabelSettingsUpdater();
// $whitelabel->setPath($sharedAppPath);
// $whitelabel->apply($whitelabelSettings);
$whitelabel = new MicroweberWhitelabelSettingsUpdater(); try {
$whitelabel->setPath($findDomain->domain_public); $whitelabelApply = new MicroweberWhitelabelWebsiteApply();
$whitelabel->apply($whiteLabelSettings); $whitelabelApply->setWebPath($findDomain->domain_public);
$whitelabelApply->setSharedPath($sharedAppPath);
$whitelabelApply->apply();
} catch (\Exception $e) {
// \Log::error('Error applying whitelabel to website: ' . $mwInstallation->installation_path);
}
$findInstallation = MicroweberInstallation::where('installation_path', $findDomain->domain_public) $findInstallation = MicroweberInstallation::where('installation_path', $findDomain->domain_public)
->where('domain_id', $findDomain->id) ->where('domain_id', $findDomain->id)