Easily handle reports on Laravel entities
roundly-consulting/reports-for-laravel is a Laravel package for easily handle reports on laravel entities.
It currently has 5 GitHub stars and 256 downloads on Packagist (latest version 1.1.1).
Install it with composer require roundly-consulting/reports-for-laravel.
Discover more Laravel packages by roundly-consulting
or browse all Laravel packages to compare alternatives.
Last updated
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.
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. If your
moderators have UUID keys (APPROVALS_KEY_TYPE=uuid), set REPORTS_PRIMARY_KEY_TYPE=uuid too.
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
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.
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.
The MIT License (MIT). Please see License File for more information.