/**
  * Handle the report comment command.
  *
  * @param \Gitamin\Commands\Comment\AddCommentCommand $command
  *
  * @return \Gitamin\Models\Comment
  */
 public function handle(AddCommentCommand $command)
 {
     $data = ['message' => $command->message, 'commentable_type' => 'Gitamin\\Models\\' . $command->commentable_type, 'commentable_id' => $command->commentable_id];
     // Link with the user.
     if ($command->author_id) {
         $data['author_id'] = $command->author_id;
     }
     // Link with the project.
     if ($command->project_id) {
         $data['project_id'] = $command->project_id;
     }
     // Create the comment
     $comment = Comment::create($data);
     event(new CommentWasAddedEvent($comment));
     return $comment;
 }
 /**
  * Seed the comments table.
  */
 protected function seedComments()
 {
     $defaultComments = [['message' => ':+1: We totally nailed the fix.', 'commentable_type' => 'Gitamin\\Models\\Issue', 'commentable_id' => 3, 'author_id' => 1, 'project_id' => 1], ['message' => ":ship: We've deployed a fix.", 'commentable_type' => 'Gitamin\\Models\\MergeRequest', 'commentable_id' => 1, 'author_id' => 3, 'project_id' => 2], ['message' => "We've identified the problem. Our engineers are currently looking at it.", 'commentable_type' => 'Gitamin\\Models\\Issue', 'commentable_id' => 1, 'author_id' => 2, 'project_id' => 1], ['message' => 'Something went wrong, with something or another.', 'commentable_type' => 'Gitamin\\Models\\Issue', 'commentable_id' => 1, 'author_id' => 1, 'project_id' => 2], ['message' => ':zap: We\'ve seen high response times from our API. It looks to be fixing itself as time goes on.', 'commentable_type' => 'Gitamin\\Models\\MergeRequest', 'commentable_id' => 1, 'author_id' => 1, 'project_id' => 3]];
     foreach ($defaultComments as $comment) {
         Comment::create($comment);
     }
 }