Skip to content

Add pivotSynced event listener to flush cache when performing BelongsToMany::sync #433

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

Merged
merged 2 commits into from
Jul 30, 2022

Conversation

d8vjork
Copy link
Contributor

@d8vjork d8vjork commented Jul 20, 2022

As title describes, we've multiple issues on our Laravel 9 based project when users saving stuff on our API.

Apparently this "stuff" has all to do with using sync (in multiple cases required for our business logic to work with the feature design).

So that's how I've found that the pivotSynced event was already available in laravel-pivot-events but not mentioned here.

I'll later today send some commits verifying / testing this scenario I had

@d8vjork d8vjork mentioned this pull request Jul 20, 2022
@Bjornftw
Copy link

@d8vjork Thanks for your PR. Waiting for merge so we can use laravel-model-caching again

@mikebronner
Copy link
Owner

@d8vjork thanks for your work on this. Please send me an update as soon as your PR is finished. Thanks! :)

@d8vjork
Copy link
Contributor Author

d8vjork commented Jul 20, 2022

Ok I've no idea how tests works, even disabling most of these event listeners tests passes 🤔

Will try to replicate the same test as attach/detach in BelongsToMany then

@d8vjork
Copy link
Contributor Author

d8vjork commented Jul 20, 2022

@mikebronner Ok test added and passing, ready to merge

@Bjornftw
Copy link

@mikebronner any updates?

@mikebronner
Copy link
Owner

@Bjornftw @d8vjork Thanks for the updates. I will take a look this weekend. :) I appreciate all you contributions! This really helps.

@mikebronner mikebronner self-assigned this Jul 28, 2022
@mikebronner mikebronner self-requested a review July 28, 2022 13:03
@mikebronner mikebronner merged commit 44f37aa into mikebronner:master Jul 30, 2022
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.

3 participants