mikebronner/laravel-pivot-events
Adds Eloquent model events for many-to-many pivot operations: sync, attach, detach, and updateExistingPivot on BelongsToMany/MorphToMany. Listen for pivotSyncing/Synced, pivotAttaching/Attached, pivotDetaching/Detached, and pivotUpdating/Updated.
sync()) to minimize overhead in high-traffic systems.Adopt if:
syncWithoutEvents).Look elsewhere if:
syncWithoutEvents or custom observers.For Executives: "This package lets us automatically respond to changes in relationships between data—like when a user’s role is updated or a product gets a new tag—without manual code. For example, if a customer’s subscription tier changes, we can instantly update their dashboard or log the change for compliance. It’s a low-risk, high-reward solution that saves development time and reduces errors from missed updates. Think of it as ‘autopilot’ for your many-to-many data connections."
For Engineering:
*"Laravel Pivot Events (v13.1.0) is a lightweight package that adds pivot-specific Eloquent events (e.g., pivotSynced, pivotAttached) to trigger actions when many-to-many relationships change. Key benefits:
sync(), attach(), detach(), and updateExistingPivot().pivotSynced events) reduce noise in your listeners.Use this for:
Example: If a user’s roles() relationship updates, you can log the change, trigger a notification, or update cached permissions—all without modifying your core business logic. Recommended for apps with dynamic relationships needing real-time reactions."*
How can I help you explore Laravel packages today?