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
AlexAnderOP14mo 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
awcodes14mo ago
As long as the relationship is set up correctly it should be fine. Not sure. Sorry.
AlexAnder
AlexAnderOP14mo ago
Probable it's because both People shares the same RelationManager.
Want results from more Discord servers?
Add your server