diff --git a/app/Http/Transformers/AccessoriesTransformer.php b/app/Http/Transformers/AccessoriesTransformer.php index ea4253e7b6..839576c729 100644 --- a/app/Http/Transformers/AccessoriesTransformer.php +++ b/app/Http/Transformers/AccessoriesTransformer.php @@ -38,7 +38,7 @@ class AccessoriesTransformer 'purchase_cost' => Helper::formatCurrencyOutput($accessory->purchase_cost), 'order_number' => ($accessory->order_number) ? e($accessory->order_number) : null, 'min_qty' => ($accessory->min_amt) ? (int) $accessory->min_amt : null, - 'remaining_qty' => (int) $accessory->numRemaining(), + 'remaining_qty' => (int) ($accessory->qty - $accessory->checkouts_count), 'checkouts_count' => $accessory->checkouts_count, 'created_by' => ($accessory->adminuser) ? [ 'id' => (int) $accessory->adminuser->id, @@ -60,7 +60,7 @@ class AccessoriesTransformer $permissions_array['user_can_checkout'] = false; - if ($accessory->numRemaining() > 0) { + if (($accessory->qty - $accessory->checkouts_count) > 0) { $permissions_array['user_can_checkout'] = true; }