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:
@@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user