All packages
Reports for Laravel
Threshold auto-actions
Set threshold to react when a subject collects enough open reports:
// config/reports.php
'threshold' => 5,ReportThresholdReached fires when a new report brings the subject’s open count (Pending plus InReview) to exactly the threshold — once per crossing: further reports past it don’t fire it again. Your app decides the action:
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Reports\Events\ReportThresholdReached;
Event::listen(function (ReportThresholdReached $event): void {
$event->subject->update(['is_hidden' => true]); // your app decides the action
// $event->count, $event->threshold are also available
});- The event carries subject (the reported model), count and threshold.
- The check runs whenever a report is filed through the facade, the GivesReports trait or CreateReportAction.
- Once resolving or rejecting reports drops the count below the threshold, the report that climbs back to it fires the event again.
- The count is taken when a report is filed — a reopened report raises it without firing.
- null (the default), a blank value (not set) or 0 disables it; anything else that is not a whole number throws InvalidConfigurationException when a report is filed.
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 cryptoBy 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.