Mass updates to Comment.

@param  \BBCMS\Http\Requests\Admin\CommentsRequest  $request
@param  \BBCMS\Models\Comment  $comment
@return \Illuminate\Http\Response
195076
public function massUpdate(CommentsRequest $request)
    {
        $this->authorize('otherUpdate', $this->model);

        $comments = $this->model->whereIn('id', $request->comments);
        $messages = [];

        switch ($request->mass_action) {
            case 'published':
                if (! $comments->update(['is_approved' => true])) {
                    $messages[] = 'unable to published';
                }
                break;
            case 'unpublished':
                if (! $comments->update(['is_approved' => false])) {
                    $messages[] = 'unable to unpublished';
                }
                break;
            case 'delete':
                if (! $comments->get()->each->delete()) {
                    $messages[] = 'unable to delete';
                }
                break;
        }

        $message = empty($messages) ? 'msg.complete' : 'msg.complete_but_null';

        return $this->makeRedirect(true, 'admin.comments.index', $message);
    }
764835
public function update(string $comment, array $params = [])
    {
        $path = $this->buildCommentsPath($comment);

        return $this->put($path, $params);
    }
614335
protected function setComment($comment)
    {
        $this->desc    = '';
        $this->tags    = [];
        $this->comment = $comment;

        $this->parseComment($comment);
    }
1010144
public function postComment($key, $comment)
	{
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters = array(
			'oauth_token' => $token['key'],
		);

		// Set the success response code.
		$this->oauth->setOption('success_code', 201);

		// Set the API base
		$base = '/v1/people/~/network/updates/key=' . $key . '/update-comments';

		// Build the xml.
		$xml = '<update-comment>
				  <comment>' . $comment . '</comment>
				</update-comment>';

		$header['Content-Type'] = 'text/xml';

		// Build the request path.
		$path = $this->getOption('api.url') . $base;

		// Send the request.
		$response = $this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);

		return $response;
	}
97199
public function deleteComment($commentId)
	{
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters = array(
			'oauth_token' => $token['key'],
		);

		// Set the success response code.
		$this->oauth->setOption('success_code', 204);

		// Set the API base
		$base = '/v1/comments/' . $commentId;

		// Build the request path.
		$path = $this->getOption('api.url') . $base;

		// Send the request.
		$response = $this->oauth->oauthRequest($path, 'DELETE', $parameters);

		return $response;
	}
1217204
public function ReplyForm($comment)
    {
        // Enables multiple forms with different names to use the same handler
        $form = $this->CommentsForm();
        $form->setName('ReplyForm_' . $comment->ID);
        $form->setHTMLID(null);
        $form->addExtraClass('reply-form');

        // Load parent into reply form
        $form->loadDataFrom([
            'ParentCommentID' => $comment->ID
        ]);

        // Customise action
        $form->setFormAction($this->Link('reply', $comment->ID));

        $this->extend('updateReplyForm', $form);

        return $form;
    }
377003
protected function _updateObject( $comment_id, $fields ) {
		$fields['comment_ID'] = $comment_id;
		$updated = (bool) wp_update_comment( $this->_addSlashesDeep( $fields ) );
		if ( $updated ) {
			$this->_debug( 'Updated comment ' . $comment_id );
		} else {
			$this->_debug( 'Update failed for comment ' . $comment_id );
		}

		return $updated;
	}
1133994
public function addComment(\Haven\CmsBundle\Entity\Comment $comment)
    {
        $comment->setContent($this);
        $this->comments[] = $comment;

        return $this;
    }
774668
def save_comment(self, comment_form, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.ResourceAdminSession.update_resource
        if comment_form.is_for_update():
            return self.update_comment(comment_form, *args, **kwargs)
        else:
            return self.create_comment(comment_form, *args, **kwargs)
866092
public function spam(Comment &$comment)
    {
        $endpoint = '/admin/comments/'.$comment->id.'/spam.json';
        $response = $this->request($endpoint, 'POST');
        $comment->setData($response['comment']);
    }
575003
public function index(CommentRequest $request)
    {
        $view = $this->response->theme->listView();

        if ($this->response->typeIs('json')) {
            $function = camel_case('get-' . $view);
            return $this->repository
                ->setPresenter(\Litecms\Blog\Repositories\Presenter\CommentPresenter::class)
                ->$function();
        }

        $comments = $this->repository->paginate();

        return $this->response->title(trans('blog::comment.names'))
            ->view('blog::comment.index', true)
            ->data(compact('comments'))
            ->output();
    }
1279462
public function addComment($comment)
    {
        $comment->setPaymentId($this->getPaymentId());
        $comment->save();

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

        return $comment;
    }
251162
public function edit(Comment $comment)
    {
        $this->authorize($comment);

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

        return $this->makeResponse('edit', compact('comment'));
    }
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'),
        ]);
    }
470485
public function dispatchCommentUpdateEvent(Post $post, Comment $comment, $changeSet)
    {
        $event = new LogCommentUpdateEvent($post, $comment, $changeSet, $this->translator);

        return $this->dispatch($event);
    }
769305
public function setComment($comment)
    {
        if ($this->_comment != $comment) {
            $this->_comment = $comment;
            if ($this->_table) {
                $this->_setComment($comment);
            }
        }
    }
1027072
public function store(CommentsServiceContract $commentsService, SaveCommentRequestContract $request): SaveResponseContract
    {
        return $this->save($commentsService, $request);
    }