NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Reports for Laravel

Duplicate prevention

With prevent_duplicates on (the default), a reporter — or a guest identifier — cannot file a second report against the same subject. The attempt throws DuplicateReportException carrying the existing report. Filings against one subject are serialized, so a double-submit can’t slip through:

use RoundlyConsulting\Reports\Exceptions\DuplicateReportException;

try {
    Reports::report($post)->by($user)->for(Reason::Spam)->create();
} catch (DuplicateReportException $e) {
    $e->existing; // the Report already on file
}

Scope

duplicate_scopeA new report is blocked when…
openthe same reporter already has a Pending or InReview report on the subject. Once it is settled, they can report again. (Default.)
anyany earlier report from the same reporter exists — settled or not.

The lookup goes through the model’s default query, so soft-deleted reports never block a new one.

What is compared

  • A signed-in reporter is matched by reporter type and id.
  • A guest is matched by guest_identifier among reports without a reporter.
  • A fully anonymous report — no reporter, no identifier — has nothing to compare and is never deduplicated.

Set prevent_duplicates to false to switch the check off entirely.

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

By donating, you agree to our donation terms.

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.