---
title: "Duplicate prevention — Reports for Laravel | Roundly"
description: "Stop the same reporter or guest from reporting a subject twice — scoped to open reports or to every report ever filed."
url: https://roundly-consulting.com/open-source/docs/reports-for-laravel/duplicate-prevention
language: en
---

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

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

# 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:

```php
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\_scope | A new report is blocked when… |
| --- | --- |
| `open` | the same reporter already has a Pending or InReview report on the subject. Once it is settled, they can report again. (Default.) |
| `any` | any 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](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/reports-for-laravel.md)
