summaryrefslogtreecommitdiff
path: root/app/Model/Base.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-07 20:06:31 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-07 20:06:31 -0400
commit4f32352fe62e47ad5ea760eb00493bdc061b2407 (patch)
tree8d5f087907dd5cba196dbfc06e626b3146659e1f /app/Model/Base.php
parent9d9e3afba2054bfa23ba6f019b7c8885c2d8415e (diff)
Add user filter/condition for notifications
Diffstat (limited to 'app/Model/Base.php')
-rw-r--r--app/Model/Base.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/Model/Base.php b/app/Model/Base.php
index 784545fe..51ae782d 100644
--- a/app/Model/Base.php
+++ b/app/Model/Base.php
@@ -143,4 +143,23 @@ abstract class Base extends \Core\Base
'url' => $this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])),
);
}
+
+ /**
+ * Group a collection of records by a column
+ *
+ * @access public
+ * @param array $collection
+ * @param string $column
+ * @return array
+ */
+ public function groupByColumn(array $collection, $column)
+ {
+ $result = array();
+
+ foreach ($collection as $item) {
+ $result[$item[$column]][] = $item;
+ }
+
+ return $result;
+ }
}