I've been banging my head against my keyboard for about 2 hours now trying to figure this out and I'm finally at a point where I just need help.
I'm looking to have Users
be able to follow Alpha
and Beta
models through a Follows
table.
Ideally so that the code could look like this:
$user = User::find(1);
$alpha = Alpha::find(1);
$beta = Beta::find(1);
$user->following()->save($alpha);
$user->following()->save($beta);
I've tried this with regular polymorphic relationships and many-to-many polymorphic relationships with varying degrees of success. I haven't been able to fully realize it no matter what I've tried and I think it's just mental exhaustion holding me back at this point.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire