feat: Implement payment method fields, refactor order creation logic to support detailed order items and VM provisioning, and add admin notifications.

This commit is contained in:
pbao9
2026-03-11 10:14:32 +07:00
parent 7fdcc01027
commit 5649674eb4
9 changed files with 208 additions and 61 deletions
@@ -145,4 +145,30 @@ class ProductController extends Controller
'message' => 'Xoá sản phẩm thành công.',
]);
}
public function getOs(int $id): JsonResponse
{
$product = Product::find($id);
if (!$product) {
return response()->json(['error' => true, 'message' => 'Không tìm thấy sản phẩm.'], 404);
}
$osList = $product->osVersions()
->with('osGroup')
->where('status', 1)
->get()
->map(fn($os) => [
'id' => $os->id,
'name' => $os->name,
'version' => $os->version,
'os_group_name' => $os->osGroup?->name,
'template_id' => $os->template_id,
]);
return response()->json([
'error' => false,
'data' => $osList,
]);
}
}