Add count column to admin group list - Refs #1181

This commit is contained in:
Samuel Georges 2015-06-27 11:02:29 +10:00
parent c9a9c6ea16
commit c06e7a831f
3 changed files with 11 additions and 3 deletions

View File

@ -110,7 +110,8 @@ return [
'list_title' => 'Manage Groups',
'new' => 'New Administrator Group',
'delete_confirm' => 'Do you really want to delete this administrator group?',
'return' => 'Return to the group list'
'return' => 'Return to the group list',
'users_count' => 'Users'
],
'preferences' => [
'not_authenticated' => 'There is no an authenticated user to load or save preferences for.'

View File

@ -26,7 +26,8 @@ class UserGroup extends GroupBase
* @var array Relations
*/
public $belongsToMany = [
'users' => ['Backend\Models\User', 'table' => 'backend_users_groups']
'users' => ['Backend\Models\User', 'table' => 'backend_users_groups'],
'users_count' => ['Backend\Models\User', 'table' => 'backend_users_groups', 'count' => true]
];
public function afterCreate()

View File

@ -9,4 +9,10 @@ columns:
description:
label: backend::lang.user.group.description_field
searchable: yes
searchable: yes
users_count:
label: backend::lang.user.group.users_count
relation: users_count
valueFrom: count
default: 0