requestData(); $this->storeComment(); Response::respondSuccess(); } private function requestData() { $this->ticketId = Controller::request('ticketId'); $this->content = Controller::request('content'); } private function storeComment() { $comment = new Comment(); $comment->setProperties(array( 'content' => $this->content )); $ticket = Ticket::getTicket($this->ticketId); $ticket->addComment($comment); $ticket->store(); } }