-
Notifications
You must be signed in to change notification settings - Fork 349
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
Add possibility to add revision when we change something with many-to-many relationship. #63
Comments
Open to pull requests on this one, I'm assuming you're talking about additional data updated on the pivot table? |
Yes, I am talking about saving information from pivot table. I found solution to my problem, but it is very specific situation, so maybe we can even call my solution as a hack ;) |
Keen to see what you did |
@tommy7600 I'm also interested in seeing how you did this. |
@tommy7600 Ditto. I'm using attach() and detach(). Perhaps we could extend attach() and detach() and listen for when they are called, and then fire our own event which we listen to. |
Any progress on this very important missing feature? |
I really need this feature as well. I am open to sponsoring some development time on it. Let me know if you have an idea on how to implement this and roughly what it would take to get the work done. |
I am also interested in this. Links to custom solutions also appreciated if development has stalled... |
any news 4 years later? |
any news 3 years later? |
The biggest problem is that we don't natively have Many to Many events. If we use the laravel-pivot package, we can monitor the pivot updates and store new revisions for both many to many classes, we only have to wait the acceptance of changes in fico7489/laravel-pivot#91 In my use case, i have a many to many relation in ports to port group: And the attach and detach events can now generate revisions as u can see in the "History changes" section on my software: This will generate two revisions, one revision for each model, as we can see above. Its simple to implement with laravel-pivot package, but im having trying yet However if the intermediate table has some more fields, we would not be able to store it in the current "revisions" table, we would have to add some more fields to accommodate this, because in the database i have used the old_value and new_value to store the model target hahahaha. Do you think it's a good idea to try adding some more fields to the table or is it worth creating another table of revisions for the case of Many to Many? |
@MuriloChianfa nice, will this support storing any changes that are made to other fields that might be on the pivot table, or limited only to the creation / destruction of a pivot? |
@duellsy only create and delete because, to add the pivot fields, we would have to add more fields to the revisions table, I imagine |
Add possibility to add revision when we change something with many-to-many relationship.
The text was updated successfully, but these errors were encountered: