Skip to content

A free open source IT asset/license management system

Added adminuser method

snipe6efd323fbf40
diff --git a/app/Models/Location.php b/app/Models/Location.php
index 9b1ed02f43..a3b047579d 100755
--- a/app/Models/Location.php
+++ b/app/Models/Location.php
@@ -135,6 +135,17 @@ class Location extends SnipeModel
return $this->hasMany(\App\Models\User::class, 'location_id');
}
+ /**
+ * Establishes the location -> admin user relationship
+ *
+ * @author A. Gianotto <[email protected]>
+ * @return \Illuminate\Database\Eloquent\Relations\Relation
+ */
+ public function adminuser()
+ {
+ return $this->belongsTo(\App\Models\User::class, 'created_by');
+ }
+
/**
* Find assets with this location as their location_id
*
diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php
index e198d10c10..1d667f700e 100755
--- a/app/Models/Supplier.php
+++ b/app/Models/Supplier.php
@@ -128,6 +128,18 @@ class Supplier extends SnipeModel
return $this->hasMany(\App\Models\Consumable::class, 'supplier_id');
}
+
+ /**
+ * Establishes the supplier -> admin user relationship
+ *
+ * @author A. Gianotto <[email protected]>
+ * @return \Illuminate\Database\Eloquent\Relations\Relation
+ */
+ public function adminuser()
+ {
+ return $this->belongsTo(\App\Models\User::class, 'created_by');
+ }
+
/**
* Establishes the supplier -> asset maintenances relationship
*