feat: Implement Plesk domain and hosting services

- Added PleskDomainService for managing domain operations (create, update, remove, get info).
- Introduced PleskHostingService for provisioning hosting accounts and notifying customers.
- Created PleskService for handling API requests to Plesk.
- Added migration to include 'type' column in dns_manager_servers table.
- Created migration for module_hosting_accounts table to track hosting subscriptions.
- Created migration for module_hosting_plesk_clients table to manage Plesk client credentials.
- Added email templates for notifying customers and admins about hosting account creation.
This commit is contained in:
baodev0
2026-08-06 17:24:01 +07:00
parent 79f06c2fa2
commit d6d63e5152
29 changed files with 1744 additions and 113 deletions
@@ -0,0 +1,48 @@
<?php
namespace App\Repositories\Module\HostingAccount;
use App\Repositories\BaseCachedRepository;
use Illuminate\Support\Facades\Cache;
class HostingAccountCachedRepository extends BaseCachedRepository implements HostingAccountRepositoryInterface
{
public function __construct(
public HostingAccountRepository $hostingAccountRepository
) {
parent::__construct();
}
public function getModel()
{
return $this->hostingAccountRepository->getModel();
}
public function filter(
array $data = [],
array $relationships = [],
array $withCount = [],
array $select = ['*'],
bool $returnQuery = false
) {
if (
$returnQuery ||
!empty($data['paginate'])
) {
return $this->hostingAccountRepository
->filter($data, $relationships, $withCount, $select, $returnQuery);
}
$cacheKey = $this->getCacheKey(md5(json_encode([
'filter' => compact('data', 'relationships', 'withCount', 'select')
])));
return Cache::remember(
$cacheKey,
$this->cacheTime,
fn() =>
$this->hostingAccountRepository
->filter($data, $relationships, $withCount, $select, $returnQuery)
);
}
}
@@ -0,0 +1,50 @@
<?php
namespace App\Repositories\Module\HostingAccount;
use App\Models\ModuleHostingAccount;
use App\Repositories\BaseRepository;
class HostingAccountRepository extends BaseRepository implements HostingAccountRepositoryInterface
{
public function getModel()
{
return ModuleHostingAccount::class;
}
public function filter(
array $data = [],
array $relationships = [],
array $withCount = [],
array $select = ['*'],
bool $returnQuery = false
) {
$query = $this->model
->select($select)
->with($relationships);
if (!empty($data['customer_id'])) {
$query->where('customer_id', $data['customer_id']);
}
if (!empty($data['status'])) {
$query->where('status', $data['status']);
}
if (!empty($withCount)) {
$query->withCount($withCount);
}
if ($returnQuery) {
return $query;
}
if (!empty($data['paginate'])) {
return $query->paginate(
$data['per_page'] ?? 15
);
}
return $query->get();
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Repositories\Module\HostingAccount;
use App\Repositories\BaseRepositoryInterface;
interface HostingAccountRepositoryInterface extends BaseRepositoryInterface
{
public function filter(
array $data = [],
array $relationships = [],
array $withCount = [],
array $select = ['*'],
bool $returnQuery = false
);
}