/** * @return bool */ public function afterSave() { $new_thread = $this->object->get('thread'); if ($this->old_thread != $new_thread) { $this->object->changeThread($this->old_thread, $new_thread); } else { $this->object->clearTicketCache(); } return parent::afterSave(); }
/** * @return bool */ public function afterSave() { if ($this->object->get('published')) { $this->thread->fromArray(array('comment_last' => $this->object->get('id'), 'comment_time' => $this->object->get('createdon'))); $this->thread->save(); } if ($this->guest) { if (!isset($_SESSION['TicketComments'])) { $_SESSION['TicketComments'] = array('ids' => array()); } $_SESSION['TicketComments']['name'] = $this->object->get('name'); $_SESSION['TicketComments']['email'] = $this->object->get('email'); $_SESSION['TicketComments']['ids'][$this->object->get('id')] = 1; } $this->thread->updateCommentsCount(); $this->object->clearTicketCache(); return parent::afterSave(); }
public function assignResource($comment) { if (is_numeric($comment)) { $comment = TicketComment::findOrFail($comment); } if ($comment->link == '' || $this->id != $comment->ticket_id) { abort(404); } $this->link = $comment->link; $this->status = 'closed'; $this->save(); $this->comments()->where('selected', true)->update(['selected' => false]); $comment->selected = true; $comment->save(); }
public function comments() { //return $this->hasMany(TicketComment::class); //php > 5.4 return $this->hasMany(TicketComment::getClass()); //php <= 5.4 create Model Entity }
/** * */ public function logManagerAction() { $this->modx->logManagerAction($this->objectType . '_undelete', $this->classKey, $this->object->get($this->primaryKeyField)); }
public function comments() { return $this->hasMany(TicketComment::getClass()); }
/** * @param string $action */ public function logManagerAction($action = '') { $this->modx->logManagerAction($this->objectType . '_unpublish', $this->classKey, $this->object->get($this->primaryKeyField)); }
/** * @return bool */ public function afterSave() { $this->object->clearTicketCache(); return parent::afterSave(); }