Skip to content

A free open source IT asset/license management system

Add 'where' clause to hasManyThrough relationship. (#4276)

Brady Wetherington189574377a86
diff --git a/app/Models/Location.php b/app/Models/Location.php
index 37348bd4a8..c524c1eb30 100755
--- a/app/Models/Location.php
+++ b/app/Models/Location.php
@@ -54,7 +54,7 @@ class Location extends SnipeModel
public function assets()
{
- return $this->hasManyThrough('\App\Models\Asset', '\App\Models\User', 'location_id', 'assigned_to', 'id');
+ return $this->hasManyThrough('\App\Models\Asset', '\App\Models\User', 'location_id', 'assigned_to', 'id')->where("assets.assigned_type",User::class);
}
public function locationAssets()