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:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Plesk;
|
||||
|
||||
use App\Facades\BaseHelperFacade as BaseHelper;
|
||||
use App\Models\DnsServer;
|
||||
use Illuminate\Http\Client\PendingRequest;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class PleskService
|
||||
{
|
||||
protected array $entryPoints = [
|
||||
'clients' => ':8443/api/v2/clients',
|
||||
'domains' => ':8443/api/v2/domains',
|
||||
];
|
||||
|
||||
public function client(DnsServer $server, int $timeout = 30): PendingRequest
|
||||
{
|
||||
return Http::withoutVerifying()
|
||||
->withBasicAuth($server->username, Crypt::decryptString($server->password))
|
||||
->timeout($timeout);
|
||||
}
|
||||
|
||||
public function url(DnsServer $server, string $entryPoint, string $suffix = ''): string
|
||||
{
|
||||
return BaseHelper::url($server->ip_address) . $this->entryPoints[$entryPoint] . $suffix;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user