From 4f32352fe62e47ad5ea760eb00493bdc061b2407 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 7 Jun 2015 20:06:31 -0400 Subject: Add user filter/condition for notifications --- app/Model/Base.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'app/Model/Base.php') 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; + } } -- cgit v1.2.3