Display comment.

@param Request $request
@param Model   $comment

@return Response
437833
public function show(CommentRequest $request, Comment $comment)
    {

        if ($comment->exists) {
            $view = 'blog::comment.show';
        } else {
            $view = 'blog::comment.new';
        }

        return $this->response->title(trans('app.view') . ' ' . trans('blog::comment.name'))
            ->data(compact('comment'))
            ->view($view, true)
            ->output();
    }
86609
public function Comment() {
      $this->Permission('Garden.Profiles.Edit');
      
      $Session = Gdn::Session();
      $this->Form->SetModel($this->ActivityModel);
      $NewActivityID = 0;
      
      // Form submitted
      if ($this->Form->IsPostBack()) {
         $Body = $this->Form->GetValue('Body', '');
         $ActivityID = $this->Form->GetValue('ActivityID', '');
         if (is_numeric($ActivityID) && $ActivityID > 0) {
            $ActivityComment = array(
                'ActivityID' => $ActivityID,
                'Body' => $Body,
                'Format' => 'Text');
            
            $ID = $this->ActivityModel->Comment($ActivityComment);
            
            if ($ID == SPAM || $ID == UNAPPROVED) {
               $this->StatusMessage = T('ActivityCommentRequiresApproval', 'Your comment will appear after it is approved.');
               $this->Render('Blank', 'Utility');
               return;
            }
            
            $this->Form->SetValidationResults($this->ActivityModel->ValidationResults());
            if ($this->Form->ErrorCount() > 0) {
               throw new Exception($this->ActivityModel->Validation->ResultsText());
               
               $this->ErrorMessage($this->Form->Errors());
            }
         }
      }
      
      // Redirect back to the sending location if this isn't an ajax request
      if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
         $Target = $this->Form->GetValue('Return');
         if (!$Target)
            $Target = '/activity';
         Redirect($Target);
      } else {
         // Load the newly added comment.
         $this->SetData('Comment', $this->ActivityModel->GetComment($ID));
         
         // Set it in the appropriate view.
         $this->View = 'comment';
      }

      // And render
      $this->Render();
   }
1319185
public function show(CommentsServiceContract $commentsService, int $id = 0): ShowResponseContract
    {
        $item = $commentsService->getItemById($id);

        return app()->makeWith(ShowResponseContract::class, [
            'item' => $item,
        ]);
    }
1279462
public function addComment($comment)
    {
        $comment->setPaymentId($this->getPaymentId());
        $comment->save();

        $this->load($this->getPaymentId());

        return $comment;
    }
412629
public function store(Request $request)
    {
        $attributes = $request->validate([
            'text' => 'required'
        ]);

        $comment = Comment::create($attributes);

        $comment->mention($request->mentions);

        return back();
    }
1302348
protected void renderComments(PageRequestContext requestContext, QueryPage queryPage, QueryReply queryReply, boolean commentable, boolean viewDiscussion) {
    Query query = queryPage.getQuerySection().getQuery();
    Panel panel = ResourceUtils.getResourcePanel(query);
    
    RequiredQueryFragment queryFragment = new RequiredQueryFragment("comments");
    queryFragment.addAttribute("panelId", panel.getId().toString());
    queryFragment.addAttribute("queryId", query.getId().toString());
    queryFragment.addAttribute("pageId", queryPage.getId().toString());
    
    if (queryReply != null) {
      queryFragment.addAttribute("queryReplyId", queryReply.getId().toString());
    }
    
    queryFragment.addAttribute("queryPageCommentable", commentable ? "true" : "false");
    queryFragment.addAttribute("queryViewDiscussion", viewDiscussion ? "true" : "false");
    addRequiredFragment(requestContext, queryFragment);  
  }
620907
public function removeComment(Comment $comment)
    {
        if ($this->comments->contains($comment)) {
            $this->comments->removeElement($comment);
        }
    }
48567
def comments(self, request_id):
        
        return self._query_zendesk(self.endpoint.comments, 'comment', id=request_id)
251162
public function edit(Comment $comment)
    {
        $this->authorize($comment);

        pageinfo([
            'title' => __('comments.edit_page'),
            'robots' => 'noindex,follow',
        ]);

        return $this->makeResponse('edit', compact('comment'));
    }
394655
public function show(Request $request)
    {
        $post = $this->api('post.fetch', $request->route('post'))->parameters(['with' => ['thread', 'thread.category', 'parent']])->get();

        event(new UserViewingPost($post));

        $thread = $post->thread;
        $category = $thread->category;

        return view('forum::post.show', compact('category', 'thread', 'post'));
    }
1344796
function newComment($post_id, array $comment)
    {
        $params = array(1, $this->username, $this->password, $post_id, $comment);

        return $this->sendRequest('wp.newComment', $params);
    }
1089252
public function commentAction(Request $request, $resourceId, User $user)
    {
        $text = $request->get('social_media_comment_text');

        if ($text !== null) {
            $comment = new CommentAction();
            $comment->setText($text);
            $comment->setUser($user);
            $commentManager = $this->getCommentActionManager();
            $userIds = $commentManager->getHasCommentedUserIds($resourceId);
            $commentManager->createComment($resourceId, $comment);
            $this->dispatchCommentEvent($comment, $userIds);
        }
        if ($request->isXmlHttpRequest()) {
            $response = new JsonResponse(true);
        } else {
            $response = $this->redirectToRoute('icap_socialmedia_comments_view', array('resourceId' => $resourceId));
        }

        return $response;
    }
359732
public function getComment($comment_id)
    {
        list($response, $statusCode, $httpHeader) = $this->getCommentWithHttpInfo ($comment_id);
        return $response; 
    }
1281505
public function dispatch(
        CommentModel $comment,
        CommentFactory $factory,
        HookFactory $hook
    ) {
        $this->comment = $comment;
        $this->factory = $factory;
        $this->hook = $hook;
    }
1289390
public function create(CommentsServiceContract $commentsService, Request $request): FormResponseContract
    {
        $item = $commentsService->getItemById();

        $parentItem = ($request->has('parent_comment_id'))
            ? $commentsService->getItemByIdForDisplay($request->get('parent_comment_id'))
            : null;

        return app()->makeWith(FormResponseContract::class, [
            'data' => compact('item', 'parentItem'),
        ]);
    }
687787
public static function add_comment(comment $comment) {
        global $DB;
        $comment->id = null;
        return $DB->insert_record('assignfeedback_editpdf_cmnt', $comment);
    }
1297744
def addComment(self, comment):
        
        url = "%s/addComment" % self.root
        params = {
            "f" : "json",
            "comment" : comment
        }
        return self._post(url, params, proxy_port=self._proxy_port,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url)