Update HostingAccountIsCreatedListener.php

This commit is contained in:
Bozhidar Slaveykov 2024-04-04 19:38:10 +03:00
parent 9cd8dcc15a
commit 5feda1a3c2

View file

@ -3,6 +3,7 @@
namespace Modules\Microweber\Listeners;
use App\Events\HostingAccountIsCreated;
use App\Models\HostingPlan;
use App\ShellApi;
use Modules\Microweber\App\Models\MicroweberInstallation;
use Psy\Shell;
@ -23,6 +24,18 @@ class HostingAccountIsCreatedListener
public function handle(HostingAccountIsCreated $event): void
{
$findWebsite = \App\Models\Website::where('id', $event->model->id)->first();
if (!$findWebsite) {
return;
}
$findHostingPlan = HostingPlan::where('id', $findWebsite->hosting_plan_id)->first();
if (!$findHostingPlan) {
return;
}
if (!in_array('microweber', $findHostingPlan->additional_services)) {
return;
}
$phyreShellExecutor = new \Modules\Microweber\Shell\Adapters\PhyreShellExecutor();