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

The Reports facade

Reports — RoundlyConsulting\Reports\Facades\Reports — is the recommended way in. Every mutation and every reason read goes through it:

use RoundlyConsulting\Approvals\Enums\ApprovalRule;
use RoundlyConsulting\Reports\Enums\Reason;
use RoundlyConsulting\Reports\Enums\Status;
use RoundlyConsulting\Reports\Facades\Reports;

// File — two fluent starts, or a DTO
Reports::report($post)->by($user)->for(Reason::Spam)->because('Spammy.')->create();
Reports::from($user)->about($post)->for('copyright')->create();
Reports::create($createReportData);

// Move and settle
Reports::review($report);                       // → InReview
Reports::resolve($report, by: $admin, note: 'Removed.');
Reports::reject($report, by: $admin, note: 'Not a violation.');
Reports::close($report);                        // → Closed (from Resolved)
Reports::changeStatus($report, Status::Pending);

// Multi-moderator sign-off
Reports::moderate($report)->requiring([$alice, $bob])->rule(ApprovalRule::Quorum)->quorum(2)->open();

// Housekeeping and reasons
Reports::prune(90);                             // → int
Reports::reasons();                             // ['spam' => 'Spam', …]
Reports::…ReturnsWhat it does
report($subject) / from($reporter)PendingReportFluent filing, about a subject or by a reporter.
create(CreateReportData $data)ReportOne-call filing from a DTO.
moderate($report)PendingModerationMulti-moderator sign-off.
resolve($report, ?$by, ?$note)ReportSettle as resolved — or, under moderation, record a named moderator’s decision.
reject($report, ?$by, ?$note)ReportSettle as rejected — or, under moderation, record a named moderator’s decision.
changeStatus($report, Status $status)ReportAny declared move; $report->changeStatusTo() delegates here.
review($report) / close($report)Report→ InReview / → Closed.
prune(?int $days = null, bool $force = false)intDelete terminal reports older than $days; what reports:prune runs.
reasons() / reasonLabel($slug) / defaultReason() / allowsReason($slug)array / string / string / boolReason reads — slug => label, a label, the default, an allow check.
fake()ReportsFakeSwap in the recording fake — see Testing.

Builders

  • report($subject) and from($reporter) return a PendingReport — about(), by(), asGuest(), for() / reason(), because(), then create(). See Filing reports.
  • moderate($report) returns a PendingModeration — requiring(), rule(), quorum(), then open(). See Multi-moderator moderation.

Model shorthands

$user->giveReportTo(), $user->report() and $report->changeStatusTo() go through the same manager, so behaviour, events and Reports::fake() are identical whichever form you use.

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.