After a submission, the package dispatches RoundlyConsulting\Forms\Events\FormSubmitted — use it to send confirmations, notify staff or fire webhooks:
use RoundlyConsulting\Forms\Events\FormSubmitted;
class NotifyAdminsOfSubmission
{
public function handle(FormSubmitted $event): void
{
// $event->form — the submitted Form
// $event->uuid — the submission reference id (string)
// $event->fieldCount — number of fields stored (int)
}
}The structure also emits lifecycle events — FormCreated, FormUpdated, FormDeleted and the equivalent Group* and Field* events, each carrying the model. Review outcomes fire their own events:
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Forms\Events\SubmissionApproved;
use RoundlyConsulting\Forms\Events\SubmissionRejected;
use RoundlyConsulting\Forms\Events\SubmissionStatusChanged;
Event::listen(function (SubmissionApproved $event): void {
$event->submission; // FormSubmission
});
Event::listen(function (SubmissionRejected $event): void {
$event->submission; // FormSubmission
$event->actor; // ?Model — the rejecting approver
});
Event::listen(function (SubmissionStatusChanged $event): void {
$event->from; // SubmissionStatus
$event->to; // SubmissionStatus
});Every event
| Event | Fired when | Properties |
|---|---|---|
FormSubmitted | submit() succeeds or a draft is finalized | form, uuid, fieldCount |
FormCreated / FormUpdated / FormDeleted | a form is created, changed or (soft) deleted | form |
GroupCreated / GroupUpdated / GroupDeleted | a group is created, changed or (soft) deleted | group |
FieldCreated / FieldUpdated / FieldDeleted | a field is created, changed or (soft) deleted | field |
SubmissionStatusChanged | a review opens or resolves (once per outcome) | submission, from, to |
SubmissionApproved | the review resolves as approved | submission |
SubmissionRejected | the review resolves as rejected | submission, actor |
Saving a draft fires no FormSubmitted — only finalizing it does. Review events fire once per outcome, even when two decisions race to resolve it. All events live in RoundlyConsulting\Forms\Events.
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.