---
title: "Moderation — Comments for Laravel | Roundly"
description: "Pending, approved and hidden states, an optional approval queue, moderation scopes and bulk approve, hide or delete."
url: https://roundly-consulting.com/open-source/docs/comments-for-laravel/moderation
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Comments for Laravel](https://roundly-consulting.com/open-source/docs/comments-for-laravel.md)

# Moderation

Each comment carries a status — pending, approved or hidden — backed by the CommentStatus enum. By default new comments are approved immediately; set require\_approval (COMMENTS\_REQUIRE\_APPROVAL=true) to hold them for review:

```php
use RoundlyConsulting\Comments\Facades\Comments;

Comments::approve($comment); // status → approved, dispatches CommentApproved
Comments::hide($comment);    // status → hidden,   dispatches CommentHidden
```

A held comment notifies nobody it mentions: approving it fires CommentMentioned for each resolved mention, once per person — see @mentions.

## Moderation queues

A site-wide moderation queue — every subject at once — starts from Comments::query():

```php
use RoundlyConsulting\Comments\Facades\Comments;

Comments::query()->pending()->mostReported()->paginate();   // every subject at once
Comments::query()->pending()->approveAll();
```

Plain query scopes on the Comment model work too:

```php
use RoundlyConsulting\Comments\Models\Comment;

Comment::pending()->get();  // awaiting review
Comment::approved()->get(); // approved
Comment::hidden()->get();   // hidden
Comment::visible()->get();  // visible === true AND status === approved
Comment::roots()->get();    // top-level comments only
```

The visible flag and the status are independent: a comment is publicly shown only when visible is true and the status is approved — exactly what the visible() scope and approvedComments check.

## Bulk moderation

The fluent query moderates everything it matches. Each terminal walks the matches by primary key and runs every row through the manager — so the policy, the lifecycle event and Comments::fake() see each comment — and returns how many were affected:

```php
// Bulk moderation — each row runs through the manager, so the policy, the lifecycle
// event and Comments::fake() all see every comment:
Comments::for($post)->pending()->approveAll(); // int: comments approved
Comments::byAuthor($user)->hideAll();          // int: comments hidden
Comments::for($post)->deleteAll();             // int: comments soft-deleted
```

## The status enum

```php
use RoundlyConsulting\Comments\Enums\CommentStatus;

$comment->status === CommentStatus::Pending;

CommentStatus::values()->all();    // ['pending', 'approved', 'hidden']
CommentStatus::labels()->all();    // ['Pending', 'Approved', 'Hidden']
CommentStatus::options();          // Collection of options (value, label, name)
CommentStatus::validationRule();   // 'in:pending,approved,hidden'
CommentStatus::Hidden->readable(); // 'Hidden'
```

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/comments-for-laravel.md)
