When events.enabled is true (the default), the following events are dispatched. Each carries the affected Connection:
use RoundlyConsulting\Connections\Events\ConnectionCreated;
use RoundlyConsulting\Connections\Events\ConnectionUpdated;
use RoundlyConsulting\Connections\Events\ConnectionRemoved;
use RoundlyConsulting\Connections\Events\ConnectionPermissionsChanged;
use RoundlyConsulting\Connections\Events\ConnectionInvited; // a pending connection was created
use RoundlyConsulting\Connections\Events\ConnectionAccepted; // status → accepted
use RoundlyConsulting\Connections\Events\ConnectionBlocked; // status → blocked
use RoundlyConsulting\Connections\Events\ConnectionRestored; // a soft-deleted link was restored
use RoundlyConsulting\Connections\Events\ConnectionExpiring; // dispatched by notify-expiring| Event | Fired when | Payload |
|---|---|---|
ConnectionCreated | A new connection is created, or a soft-deleted pair is revived fresh — connect, invite, grant/sync on a missing pair, bulk and sync attaches. | $connection |
ConnectionUpdated | connect() changes an existing pair, or extend() changes the expiry. | $connection |
ConnectionRemoved | disconnect(), disconnectAll() or a sync detach soft-deletes a connection. | $connection |
ConnectionPermissionsChanged | grant, revoke, sync or clear actually changes an existing set. | $connection, $previous, $current |
ConnectionInvited | A new connection is created in the pending state. | $connection |
ConnectionAccepted | The status changes to accepted. | $connection |
ConnectionBlocked | The status changes to blocked. | $connection |
ConnectionRestored | reconnect() / restore() / reconnectTo() restores a soft-deleted row, or connect() restores a soft-deleted blocked pair still blocked. | $connection |
ConnectionExpiring | connections:notify-expiring runs — one event per row of Connections::expiring($days). | $connection, $daysUntilExpiry |
Lean on these events for auditing and notifications — the package ships no audit table. For example, listeners that log acceptances and diff permission changes:
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Connections\Events\ConnectionAccepted;
use RoundlyConsulting\Connections\Events\ConnectionPermissionsChanged;
// In a service provider's boot() method.
Event::listen(function (ConnectionAccepted $event): void {
logger()->info('Connection accepted', ['connection' => $event->connection->id]);
});
Event::listen(function (ConnectionPermissionsChanged $event): void {
$added = array_diff($event->current, $event->previous);
$removed = array_diff($event->previous, $event->current);
// write $added / $removed to your own audit log
});- connections:prune soft-deletes expired rows in a single query, so it dispatches no ConnectionRemoved events.
- Bulk verbs and syncConnections() still fire one event per affected connection.
- Set events.enabled to false to silence every package event, including ConnectionExpiring.
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.