From 121e158f39bdc634ce481cd4c59eaebc18dae108 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 31 Oct 2017 05:22:57 -0700 Subject: [PATCH] Change method name from userloc to location This needs to be changed in more places though --- app/Http/Controllers/Api/UsersController.php | 2 +- app/Models/User.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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 **/