Update ModelHostingSubscriptionDeletingListener.php
This commit is contained in:
parent
ccbce0ba45
commit
e6e764b98d
1 changed files with 7 additions and 0 deletions
|
@ -5,6 +5,7 @@ namespace App\Listeners;
|
|||
use App\Actions\GetLinuxUser;
|
||||
use App\Events\ModelHostingSubscriptionCreated;
|
||||
use App\Events\ModelHostingSubscriptionDeleting;
|
||||
use App\Models\Domain;
|
||||
|
||||
class ModelHostingSubscriptionDeletingListener
|
||||
{
|
||||
|
@ -29,6 +30,12 @@ class ModelHostingSubscriptionDeletingListener
|
|||
shell_exec('userdel ' . $event->model->system_username);
|
||||
shell_exec('rm -rf /home/' . $event->model->system_username);
|
||||
}
|
||||
$findRelatedDomains = Domain::where('hosting_subscription_id', $event->model->id)->get();
|
||||
if ($findRelatedDomains->count() > 0) {
|
||||
foreach ($findRelatedDomains as $domain) {
|
||||
$domain->delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue