- Mail campaign: mẫu nhắc gia hạn thanh toán QR, chọn dịch vụ + chu kỳ từng dòng (renewal_services) - Hosting: nhiều server Plesk cho một gói (service_plan_servers), chuyển server khi server chết - Admin xem/sửa giấy tờ định danh khách, tuỳ chọn gia hạn cho khách, nhật ký cấp phát dịch vụ - Đánh dấu mẫu email dịch vụ là non-marketing Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
66 lines
2.2 KiB
PHP
66 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Hosting;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ServicePlanRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'title' => 'required|string|max:255',
|
|
'description' => 'nullable|string|max:2000',
|
|
'vcpu' => 'required|integer|min:0',
|
|
'ram' => 'required|integer|min:0',
|
|
'disk' => 'required|integer|min:0',
|
|
'domain' => 'required|integer|min:0',
|
|
'bandwidth' => 'nullable|integer|min:0',
|
|
'databases' => 'nullable|integer|min:0',
|
|
'mailboxes' => 'nullable|integer|min:0',
|
|
'mailbox_quota' => 'nullable|integer|min:0',
|
|
'ftp_accounts' => 'nullable|integer|min:0',
|
|
'subdomains' => 'nullable|integer|min:0',
|
|
'domain_aliases' => 'nullable|integer|min:0',
|
|
'features' => 'nullable|array|max:30',
|
|
'features.*' => 'string|distinct|max:100',
|
|
'is_active' => 'boolean',
|
|
'sort_order' => 'nullable|integer|min:0',
|
|
'server_ids' => 'nullable|array|max:10',
|
|
'server_ids.*' => 'integer|distinct|exists:dns_manager_servers,id',
|
|
'plesk_plan_name' => 'nullable|string|max:255',
|
|
'note' => 'nullable|string',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function planAttributes(): array
|
|
{
|
|
$validated = $this->validated();
|
|
|
|
return [
|
|
...collect($validated)->except(['plesk_plan_name', 'note', 'server_ids'])->all(),
|
|
'sort_order' => $validated['sort_order'] ?? 0,
|
|
'is_active' => $validated['is_active'] ?? true,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<int, int>
|
|
*/
|
|
public function serverIds(): array
|
|
{
|
|
return $this->validated()['server_ids'] ?? [];
|
|
}
|
|
}
|