- Gửi email theo template cho 1 khách, tab lịch sử email, nhắc gia hạn dịch vụ hàng loạt - Mail lưu from/bcc/sent_by; mẫu MARKETING và mẫu cũ trong TemplateSeeder - Gói hosting: giới hạn, trạng thái, lấy plan Plesk qua CLI gateway - Backfill payment_method và ngày đơn hàng còn thiếu - Bổ sung field CPU/RAM/Disk/Băng thông cho loại sản phẩm vps và cloud Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
2.1 KiB
PHP
58 lines
2.1 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',
|
|
'dns_manager_server_id' => 'nullable|integer|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'])->all(),
|
|
'dns_manager_server_id' => $validated['dns_manager_server_id'] ?? null,
|
|
'sort_order' => $validated['sort_order'] ?? 0,
|
|
'is_active' => $validated['is_active'] ?? true,
|
|
];
|
|
}
|
|
}
|