Skip to content

Commit

Permalink
Update DomainIsCreatedListener.php
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Oct 10, 2024
1 parent c274d89 commit aff951e
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions web/Modules/Microweber/Listeners/DomainIsCreatedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Services\HostingSubscriptionService;
use Illuminate\Support\Str;
use MicroweberPackages\SharedServerScripts\MicroweberWhitelabelSettingsUpdater;
use MicroweberPackages\SharedServerScripts\MicroweberWhitelabelWebsiteApply;
use Modules\Microweber\App\Models\MicroweberInstallation;

class DomainIsCreatedListener
Expand Down Expand Up @@ -143,12 +144,22 @@ public function handle(DomainIsCreated $event): void

if (isset($status['success']) && $status['success']) {

$whiteLabelSettings = [];
$whiteLabelSettings['website_manager_url'] = $website_manager_url;
$sharedAppPath = config('microweber.sharedPaths.app');
// $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();
$whitelabel->setPath($findDomain->domain_public);
$whitelabel->apply($whiteLabelSettings);
try {
$whitelabelApply = new MicroweberWhitelabelWebsiteApply();
$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)
->where('domain_id', $findDomain->id)
Expand Down

0 comments on commit aff951e

Please sign in to comment.