Skip to content

A free open source IT asset/license management system

Fixed typo

snipe6cca24be8e70
diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.php
index bdb01cdf01..1e82ab4685 100644
--- a/app/Http/Controllers/Api/ComponentsController.php
+++ b/app/Http/Controllers/Api/ComponentsController.php
@@ -59,7 +59,7 @@ class ComponentsController extends Controller
$components = Component::select('components.*')
->with('company', 'location', 'category', 'supplier', 'adminuser', 'manufacturer')
- ->withSum('uncontrainedAssets as sum_unconstrained_assets', 'components_assets.assigned_qty');
+ ->withSum('unconstrainedAssets as sum_unconstrained_assets', 'components_assets.assigned_qty');
$filter = [];
diff --git a/app/Models/Component.php b/app/Models/Component.php
index 1a530b8883..2025b0b3ff 100644
--- a/app/Models/Component.php
+++ b/app/Models/Component.php
@@ -269,7 +269,7 @@ class Component extends SnipeModel
// is *not* null - so we don't have to keep recalculating for un-checked-out components
// NOTE: doing this will add a 'pseudo-attribute' to the component in question, so we need to _remove_ this
// before we save - so that gets handled in the 'saving' callback defined in the 'booted' method, above.
- $this->sum_unconstrained_assets = $this->uncontrainedAssets()->sum('assigned_qty') ?? 0;
+ $this->sum_unconstrained_assets = $this->unconstrainedAssets()->sum('assigned_qty') ?? 0;
}
return $this->sum_unconstrained_assets;
}
@@ -280,7 +280,7 @@ class Component extends SnipeModel
*
* This allows us to get the assets with assigned components without the company restriction
*/
- public function uncontrainedAssets()
+ public function unconstrainedAssets()
{
return $this->belongsToMany(\App\Models\Asset::class, 'components_assets')