All events live under RoundlyConsulting\Requests\Events and carry public properties:
| Event | Payload | Fired when |
|---|---|---|
RequestCreated | Request $request | A request is created. |
RequestStatusChanged | Request $request | The status changes — by a direct decision, reopen, cancel, expire, or the engine resolving the approval request. |
ApprovalRecorded | Request $request, Model $actor | An approval is recorded through the facade or ResolveRequest — even when the request stays New. |
ApprovalRevoked | Request $request, Model $actor | reopen() moves the request back to New — withdrawing the actor’s decision while the round is still open. |
RequestRejected | Request $request, Model $actor | A rejection resolves the request to Rejected; the actor is the latest rejecting approver. |
RequestCancelled | Request $request | cancel() is called, or the approvals engine resolves the round as cancelled. |
RequestExpired | Request $request | expire() is called (directly or by requests:expire), or the approvals engine lapses the round. |
Listening
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Requests\Enums\Status;
use RoundlyConsulting\Requests\Events\RequestRejected;
use RoundlyConsulting\Requests\Events\RequestStatusChanged;
Event::listen(function (RequestStatusChanged $event): void {
if ($event->request->status === Status::Approved) {
// notify the author, write an audit entry, kick off the payout…
}
});
Event::listen(function (RequestRejected $event): void {
$event->request; // the Request
$event->actor; // the approver who rejected it
});The events fire however the change arrived: a round the approvals engine lapses (its own expiry, Approvals::expire()) expires the request and fires RequestStatusChanged and RequestExpired too, and a round the engine cancels fires RequestStatusChanged and RequestCancelled.
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.