diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-03-11 17:30:09 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-03-11 17:30:09 -0500 |
commit | d1edac845ce81f8ccf43a43803ab0a89574f285c (patch) | |
tree | 5732aff4223edcb34813b1afbcd09504dc9d26c0 /app/Model | |
parent | a22b8f3dc73555800caf55768f04a7a2ce4af7f2 (diff) |
Change groups list layout
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/GroupModel.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/Model/GroupModel.php b/app/Model/GroupModel.php index b43423b3..5acf7e3f 100644 --- a/app/Model/GroupModel.php +++ b/app/Model/GroupModel.php @@ -27,7 +27,9 @@ class GroupModel extends Base */ public function getQuery() { - return $this->db->table(self::TABLE); + return $this->db->table(self::TABLE) + ->columns('id', 'name', 'external_id') + ->subquery('SELECT COUNT(*) FROM '.GroupMemberModel::TABLE.' WHERE group_id='.self::TABLE.'.id', 'nb_users'); } /** @@ -39,7 +41,7 @@ class GroupModel extends Base */ public function getById($group_id) { - return $this->getQuery()->eq('id', $group_id)->findOne(); + return $this->db->table(self::TABLE)->eq('id', $group_id)->findOne(); } /** @@ -51,7 +53,7 @@ class GroupModel extends Base */ public function getByExternalId($external_id) { - return $this->getQuery()->eq('external_id', $external_id)->findOne(); + return $this->db->table(self::TABLE)->eq('external_id', $external_id)->findOne(); } /** |