Is there a way to clone a model with a relation, but on the related model also update another ID column to match the equivalent cloned model's ID?
e.g.
Say you have Section containing many Posts and Comments. A post has many comments. But a comment also belongsTo a different post in that section:
Table: comments
id | post_id | related_post_id
Clone a section & Posts, with comments (straight forward)
But then if I make the relatedPost relationship cloneable, yes it updates the related_post_id in the new comment row, but it also creates a new clone of that post too. How can I get it to just change the foreign_id without creating double posts?
Is there a way to clone a model with a relation, but on the related model also update another ID column to match the equivalent cloned model's ID?
e.g.
Say you have Section containing many Posts and Comments. A post has many comments. But a comment also belongsTo a different post in that section:
Table: comments
id | post_id | related_post_idClone a section & Posts, with comments (straight forward)
But then if I make the relatedPost relationship cloneable, yes it updates the related_post_id in the new comment row, but it also creates a new clone of that post too. How can I get it to just change the foreign_id without creating double posts?