Add email notifications
This commit is contained in:
@@ -20,6 +20,14 @@ class Comment extends Base
|
||||
*/
|
||||
const TABLE = 'comments';
|
||||
|
||||
/**
|
||||
* Events
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const EVENT_UPDATE = 'comment.update';
|
||||
const EVENT_CREATE = 'comment.create';
|
||||
|
||||
/**
|
||||
* Get all comments for a given task
|
||||
*
|
||||
@@ -95,7 +103,14 @@ class Comment extends Base
|
||||
{
|
||||
$values['date'] = time();
|
||||
|
||||
return $this->db->table(self::TABLE)->save($values);
|
||||
if ($this->db->table(self::TABLE)->save($values)) {
|
||||
|
||||
$values['id'] = $this->db->getConnection()->getLastId();
|
||||
$this->event->trigger(self::EVENT_CREATE, $values);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,10 +122,14 @@ class Comment extends Base
|
||||
*/
|
||||
public function update(array $values)
|
||||
{
|
||||
return $this->db
|
||||
$result = $this->db
|
||||
->table(self::TABLE)
|
||||
->eq('id', $values['id'])
|
||||
->update(array('comment' => $values['comment']));
|
||||
|
||||
$this->event->trigger(self::EVENT_UPDATE, $values);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user