Custom AttachAction

Can someone can help? I have peoples connected thru polymorphic relation MorphToMany. When I attach person to person, in db I get
[
'person_id' => 1,
'personable_id' => 2,
'personable_type' => 'App\Models\Person',
];
[
'person_id' => 1,
'personable_id' => 2,
'personable_type' => 'App\Models\Person',
];
The questions is: Ho to customize AttachAction to get records in db in both directions, so on both persons I get relation with each other?
4 Replies
AlexAnder
AlexAnder10mo ago
It's already there. Maybe I'm wrong but, I need 2 recordsds in db with one action. Like Person1 -> Person2 and Person2 -> Person1 in case of polymorphic relation MorphToMany. I realize, that People->Application it's works both directions with one db record, but People->People not.. What can it be wrong?
awcodes
awcodes10mo ago
As long as the relationship is set up correctly it should be fine. Not sure. Sorry.
AlexAnder
AlexAnder10mo ago
Probable it's because both People shares the same RelationManager.