Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix event firing for extended models #2055

Open
wants to merge 2 commits into
base: 1.x
Choose a base branch
from

Conversation

alecritson
Copy link
Collaborator

Currently when models are extended, any observers which are registered by Lunar are not taking into account by model events as the signature changes.

For example Lunar registers listeners to : eloquent:updating: Lunar\Models\Product however if you had your own custom model, the signature will be eloquent:updating: App\Models\Product which means the observers aren't dispatched.

This PR looks to override the default fireModelEvent method and add in an extra check to see if we're dealing with an extended model and, if so, dispatch any events for the Lunar\Models\Product counterpart.

@alecritson alecritson requested a review from glennjacobs January 3, 2025 12:43
Copy link

vercel bot commented Jan 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 0:43am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants