---
title: "Auto-moderation — Reviews for Laravel | Roundly"
description: "Screen new and edited reviews with the built-in banned-word moderator or your own ReviewModerator — approve, reject or leave pending."
url: https://roundly-consulting.com/open-source/docs/reviews-for-laravel/auto-moderation
language: en
---

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

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

# Auto-moderation

Every new review that isn’t force-approved — and every edit to a review’s rating, title or content (see Updating & deleting) — passes through the configured ReviewModerator. It returns a ModerationOutcome: approve, reject (with an optional reason) or pending. The default NullModerator always answers pending, so reviews keep the default status.

## Banned-word filter

The bundled, dependency-free WordListModerator auto-rejects any review whose title or content contains a banned word — whole-word, case-insensitive and in any script, so idiót or дурак match like scam does. Clean reviews stay pending for the normal flow:

```php
// config/reviews.php
'moderator' => RoundlyConsulting\Reviews\Moderation\WordListModerator::class,
'moderation' => ['banned_words' => ['spam', 'scam']],
```

Or keep the list in the environment:

```bash
REVIEWS_BANNED_WORDS=spam,scam,casino
```

An entry with a space or punctuation (rip off, f\*ck) is split into words like the text and matches as consecutive words: What a rip off and f\*ck this are rejected, ripoff and trip offer are not. An entry with no word in it (\*\*\*) is ignored.

A rejected review gets the translatable reviews::messages.review.banned\_word message as its meta.rejection\_reason.

## Your own moderator

Implement the contract and bind it through the moderator config key. It is resolved from the container, so constructor injection works:

```php
use RoundlyConsulting\Reviews\Contracts\ReviewModerator;
use RoundlyConsulting\Reviews\DataTransferObjects\ModerationOutcome;
use RoundlyConsulting\Reviews\Models\Review;

final class TrustedBuyerModerator implements ReviewModerator
{
    public function moderate(Review $review): ModerationOutcome
    {
        if (str_contains((string) $review->content, 'http')) {
            return ModerationOutcome::reject('Links are not allowed');
        }

        if ($review->verified && $review->rating !== null) {
            return ModerationOutcome::approve();
        }

        return ModerationOutcome::pending();   // leave it for a human
    }
}

// config/reviews.php
'moderator' => App\Reviews\TrustedBuyerModerator::class,
```

- ModerationOutcome::approve() — approved immediately, approved\_at stamped.
- ModerationOutcome::reject('reason') — rejected, the reason stored under meta.rejection\_reason.
- ModerationOutcome::pending() — left at default\_status for a human.

The moderator sees the whole, still unsaved review: $review->author and $review->reviewable are already associated, and $review->exists tells a create (false) from an edit (true, with getOriginal() holding the previous values). Rejected reviews and owner responses are never re-moderated.

## 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/reviews-for-laravel.md)
