From 46a76e2c55000f31242eef5788c3162c43fcd03c Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 25 Mar 2016 17:45:50 -0700 Subject: [PATCH] More compact user code --- app/Http/Controllers/LocationsController.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.php index 58ffc1243e..732fc701fa 100755 --- a/app/Http/Controllers/LocationsController.php +++ b/app/Http/Controllers/LocationsController.php @@ -374,18 +374,15 @@ class LocationsController extends Controller public function getDataViewUsers($locationID) { $location = Location::find($locationID); - $location_users = $location->users; - $count = $location_users->count(); - $rows = array(); - foreach ($location_users as $user) { + foreach ($location->users as $user) { $rows[] = array( 'name' => (string)link_to('/admin/users/'.$user->id.'/view', e($user->fullName())) ); } - $data = array('total' => $count, 'rows' => $rows); + $data = array('total' => $location->users->count(), 'rows' => $rows); return $data; } @@ -413,7 +410,6 @@ class LocationsController extends Controller 'asset_tag' => e($asset->asset_tag), 'serial' => e($asset->serial), 'model' => e($asset->model->name), - ); }