From d1edac845ce81f8ccf43a43803ab0a89574f285c Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 11 Mar 2017 17:30:09 -0500 Subject: Change groups list layout --- app/Model/GroupModel.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'app/Model') 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(); } /** -- cgit v1.2.3