feat: Implement order and invoice management, enhance addon features, and remove the 'Type' module.

This commit is contained in:
pbao9
2026-02-11 17:02:07 +07:00
parent 58a9aa685b
commit 556b2c02e6
47 changed files with 1367 additions and 497 deletions
@@ -0,0 +1,43 @@
<?php
namespace App\Http\Requests\Api\Order;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use App\Enums\Product\ProductBillingCycle;
class StoreOrderRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'product_id' => 'required|exists:products,id',
'billing_cycle'=> ['required', Rule::enum(ProductBillingCycle::class), 'exists:product_pricings,billing_cycle'],
'server_name' => 'nullable|string|max:255',
'os_id' => 'nullable|exists:os,id',
'addons' => 'array',
'addons.*.addon_id' => 'required|exists:product_addon,id',
'addons.*.qty' => 'required|integer|min:1',
];
}
public function messages(): array
{
return [
'product_id.required' => 'Vui lòng chọn sản phẩm',
'product_id.exists' => 'Sản phẩm không tồn tại',
'billing_cycle.required' => 'Vui lòng chọn chu kỳ thanh toán',
'billing_cycle.enum' => 'Chu kỳ thanh toán không hợp lệ',
'billing_cycle.exists' => 'Chu kỳ thanh toán không áp dụng cho sản phẩm này',
'os_id.exists' => 'Hệ điều hành không hợp lệ',
'addons.*.addon_id.exists' => 'Addon không tồn tại',
'addons.*.qty.min' => 'Số lượng addon phải lớn hơn 0',
];
}
}