Update HostingSubscription.php

This commit is contained in:
Bozhidar 2024-05-12 21:26:16 +03:00
parent a7f6c59818
commit d43c776c65

View file

@ -41,6 +41,10 @@ class HostingSubscription extends Model
parent::boot(); parent::boot();
static::creating(function ($model) { static::creating(function ($model) {
$findDomain = Domain::where('domain', $model->domain)->first();
if ($findDomain) {
throw new \Exception('Domain already exists');
}
$create = $model->_createLinuxWebUser($model); $create = $model->_createLinuxWebUser($model);
if (isset($create['system_username']) && isset($create['system_password'])) { if (isset($create['system_username']) && isset($create['system_password'])) {
$model->system_username = $create['system_username']; $model->system_username = $create['system_username'];