Skip to content

A free open source IT asset/license management system

Fixed #6248 - add free seats to licenses API endpoint

snipee5d0f74ba750
diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php
index f85fa2314a..5df6c52d3e 100644
--- a/app/Http/Controllers/Api/LicensesController.php
+++ b/app/Http/Controllers/Api/LicensesController.php
@@ -150,7 +150,7 @@ class LicensesController extends Controller
public function show($id)
{
$this->authorize('view', License::class);
- $license = License::findOrFail($id);
+ $license = License::withCount('freeSeats')->findOrFail($id);
$license = $license->load('assignedusers', 'licenseSeats.user', 'licenseSeats.asset');
return (new LicensesTransformer)->transformLicense($license);
}