Пример #1
0
 /**
  * Create a comment in an issue
  *
  * @param int                 $index
  * @param Model\User          $user
  * @param Model\Project\Issue $issue
  *
  * @return Model\Project\Issue\Comment
  */
 public function createComment($index = 0, Model\User $user, Model\Project\Issue $issue)
 {
     $comment = new Model\Project\Issue\Comment();
     $comment->setRelation('project', $issue->project);
     $comment->setRelation('issue', $issue);
     $comment->setRelation('user', $user);
     $comment->createComment(['comment' => 'Comment ' . $index, 'upload_token' => '-']);
     return $comment;
 }
Пример #2
0
 /**
  *  Delete a project
  *
  * @return void
  *
  * @throws \Exception
  */
 public function delete()
 {
     $id = $this->id;
     parent::delete();
     /* Delete all children from the project */
     Project\Issue::where('project_id', '=', $id)->delete();
     Project\Issue\Comment::where('project_id', '=', $id)->delete();
     Project\User::where('project_id', '=', $id)->delete();
     User\Activity::where('parent_id', '=', $id)->delete();
 }
Пример #3
0
 /**
  * Ajax: to delete a comment
  *
  * @param Comment $comment
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function getDeleteComment(Comment $comment)
 {
     $comment->deleteComment();
     return response()->json(['status' => true]);
 }