Closed michal-kusy closed 2 years ago
Thank you for the valuable contribution. I did a complete rewrite for the whole package and changed how this feature works. In the new refactor, it actually uses normal relationships, and should be easy and straightforward like default Laravel relationships. Although, that refactor is incomplete.
I'm still not happy with the overall performance (I believe we can reduce number of executed queries), if you want to check it out, see https://github.com/rinvex/laravel-attributes/tree/refactor-to-native-laravel-relationships
Currently no plans to merge that rewrite, but hopefully sometime I can get it to a stable state, improve performance and release it. Any help with that branch would be much appreciated! 🙂
@Omranic If there is no plan to merge your rewrite, would you reconsider opening this PR back up and merging the fix? The affected code is deleting arbitrary unrelated data, which is a pretty serious issue.
Done! ✅ @drrcknlsn @michal-kusy
Fixes issue when trashing/replacing multiple attribute types leads to data integrity issues (deleting IDs in different/first found model) and duplicating data (especially for replace in collections).