Skip to content

A free open source IT asset/license management system

Change method name from userloc to location

snipe121e158f39bd
diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php
index ed106cc49c..37dc05cacd 100644
--- a/app/Http/Controllers/Api/UsersController.php
+++ b/app/Http/Controllers/Api/UsersController.php
@@ -53,7 +53,7 @@ class UsersController extends Controller
'users.activated',
'users.avatar',
- ])->with('manager', 'groups', 'userloc', 'company', 'department','throttle','assets','licenses','accessories','consumables')
+ ])->with('manager', 'groups', 'location', 'company', 'department','throttle','assets','licenses','accessories','consumables')
->withCount('assets','licenses','accessories','consumables');
$users = Company::scopeCompanyables($users);
diff --git a/app/Models/User.php b/app/Models/User.php
index d4eb84e0e1..537e07f5ad 100755
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -199,12 +199,22 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
/**
* Get the asset's location based on the assigned user
+ * @todo - this should be removed once we're sure we've switched it
+ * to location()
**/
public function userloc()
{
return $this->belongsTo('\App\Models\Location', 'location_id')->withTrashed();
}
+ /**
+ * Get the asset's location based on the assigned user
+ **/
+ public function location()
+ {
+ return $this->belongsTo('\App\Models\Location', 'location_id')->withTrashed();
+ }
+
/**
* Get the user's manager based on the assigned user
**/