Search by

roundly-consulting / reports-for-laravel

mihaliak

Easily handle reports on Laravel entities

Package info

github.com/roundly-consulting/reports-for-laravel

pkg:composer/roundly-consulting/reports-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 16

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 18:10 UTC

This package is auto-updated.

Last update: 2026-10-03 18:31:56 UTC


README

Reports for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Reports for Laravel

Content moderation and flagging for Laravel. Let users or anonymous guests report any model with a typed reason, move each report through a guarded status lifecycle, block duplicate reports, require several moderators to agree before a report settles, and react when a subject crosses a reporting threshold.

Installation

Requires PHP 8.4, Laravel 12 or 13.

composer require roundly-consulting/reports-for-laravel
php artisan vendor:publish --tag="reports-migrations"
php artisan vendor:publish --tag="approvals-migrations"
php artisan migrate

The approvals migrations back moderation and are needed too. If your reporter, reportable or resolver models have UUID/ULID keys, set REPORTS_KEY_TYPE before migrating.

Usage

Prepare your models:

use Illuminate\Database\Eloquent\Model;
use RoundlyConsulting\Reports\Contracts\Reportable;
use RoundlyConsulting\Reports\Contracts\Reporter;
use RoundlyConsulting\Reports\Traits\GivesReports;
use RoundlyConsulting\Reports\Traits\HasReports;

class User extends Model implements Reporter
{
    use GivesReports;
}

class Post extends Model implements Reportable
{
    use HasReports;
}

File a report, then settle it:

use RoundlyConsulting\Reports\Enums\Reason;
use RoundlyConsulting\Reports\Facades\Reports;

$report = Reports::report($post)
    ->by($user)
    ->for(Reason::Abuse)                       // a typed, validated reason
    ->because('This post violates the community guidelines.')
    ->create();                                // a second report by $user throws DuplicateReportException

Reports::review($report);                      // pending → in review
Reports::resolve($report, by: $moderator, note: 'Removed the post.');

$post->reportsCount();                         // 1
Post::query()->mostReported()->get();          // the most-reported posts first

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/reports-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

The MIT License (MIT). Please see License File for more information.