Closed andreiamza closed 3 years ago
The Varbox\Traits\HasDuplicates
automatically duplicates all your eloquent model relationships by default, so that's why there's no option to include any relationships to be duplicated, because they all are duplicated by default.
Also, in the event where you don't want certain relations duplicated (such as belongs to
relations), you have the option to exclude them (as you already stated): https://varbox.io/docs/2.x/duplicate-records#exclude-relations
So to answer your questions, you don't need to do anything to include your comments
and author
relations into the duplication functionality, as they will be included by default.
Suggestion: Depending on you database structure and logic architecture, I think you should consider converting the author
relation into a belongs to
, instead of has one
, but that's up to you.
What are you trying to achieve (screenshots might help):
I’m using the
HasDuplicates
trait on myPost
custom entity.The
Post
has 2 relations:comments
author
How can I configure the duplicate functionality in order to duplicate a post record along with its relationships:
comments
andauthor
?I see in your documentation that I have the option of excluding relations, but not to include them.