diff --git a/app/config/version.php b/app/config/version.php
index bcc12e61ca..cfb5a0067e 100644
--- a/app/config/version.php
+++ b/app/config/version.php
@@ -1,5 +1,5 @@
'v1.2.7-master',
- 'hash_version' => 'v1.2.7-master-43-g704d66b',
+ 'hash_version' => 'v1.2.7-master-44-g1960448',
);
\ No newline at end of file
diff --git a/app/controllers/admin/UsersController.php b/app/controllers/admin/UsersController.php
index 2c0e45a562..9a0868fd25 100755
--- a/app/controllers/admin/UsersController.php
+++ b/app/controllers/admin/UsersController.php
@@ -687,7 +687,7 @@ class UsersController extends AdminController
public function getDatatable($status = null)
{
- $users = User::with('assets','accessories','licenses','manager','sentryThrottle','groups','userloc');
+ $users = User::with('assets','accessories','consumables','licenses','manager','sentryThrottle','groups','userloc');
switch ($status) {
case 'deleted':
@@ -765,12 +765,17 @@ class UsersController extends AdminController
{
return $users->accessories->count();
})
+ ->addColumn('consumables',function($users)
+ {
+ return $users->consumables->count();
+ })
+
->addColumn('groups',function($users)
{
$group_names = '';
foreach ($users->groups as $group) {
- $group_names .= ''.$group->name.' ';
+ $group_names .= ''.$group->name.' ';
}
return $group_names;
})
@@ -778,7 +783,7 @@ class UsersController extends AdminController
->addColumn($actions)
->searchColumns('name','email','manager','activated','groups','location')
- ->orderColumns('name','email','manager','activated', 'licenses','assets','accessories','groups','location')
+ ->orderColumns('name','email','manager','activated', 'licenses','assets','accessories','consumables','groups','location')
->make();
}
diff --git a/app/models/User.php b/app/models/User.php
index 31a30ae08c..460ce51dc1 100755
--- a/app/models/User.php
+++ b/app/models/User.php
@@ -23,7 +23,7 @@ class User extends SentryUserModel
{
return "{$this->first_name} {$this->last_name}";
}
-
+
/**
* Returns the user Gravatar image url.
@@ -43,12 +43,17 @@ class User extends SentryUserModel
{
return $this->hasMany('Asset', 'assigned_to')->withTrashed();
}
-
+
public function accessories()
{
return $this->belongsToMany('Accessory', 'accessories_users', 'assigned_to','accessory_id')->withPivot('id')->withTrashed();
}
+ public function consumables()
+ {
+ return $this->belongsToMany('Consumable', 'consumables_users', 'assigned_to','consumable_id')->withPivot('id')->withTrashed();
+ }
+
public function licenses()
{
return $this->belongsToMany('License', 'license_seats', 'assigned_to', 'license_id')->withPivot('id');
@@ -77,32 +82,32 @@ class User extends SentryUserModel
{
return $this->belongsTo('User','manager_id')->withTrashed();
}
-
-
+
+
public function accountStatus()
{
if ($this->sentryThrottle) {
if ($this->sentryThrottle->suspended==1) {
- return 'suspended';
+ return 'suspended';
} elseif ($this->sentryThrottle->banned==1) {
- return 'banned';
- } else {
+ return 'banned';
+ } else {
return false;
}
} else {
return false;
}
}
-
- public function sentryThrottle() {
- return $this->hasOne('Throttle');
+
+ public function sentryThrottle() {
+ return $this->hasOne('Throttle');
}
-
+
public function scopeGetDeleted($query)
{
return $query->withTrashed()->whereNotNull('deleted_at');
}
-
+
public function scopeGetNotDeleted($query)
{
return $query->whereNull('deleted_at');
diff --git a/app/views/backend/users/index.blade.php b/app/views/backend/users/index.blade.php
index ea3ddb9093..85054dc829 100755
--- a/app/views/backend/users/index.blade.php
+++ b/app/views/backend/users/index.blade.php
@@ -41,6 +41,7 @@
'',
'',
'',
+ '',
Lang::get('general.groups'),
Lang::get('table.actions')
)