Trying to Create a polymorphic Relationship with an additional Relationship added to the Mix... #35617
Unanswered
Dan6erbond
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is a confusing one for me, because I don't really think Laravel's Eloquent polymorphic relationships were meant for this, but I have a rather interesting setup that would benefit from a (hacky?) solution allowing me to map objects with one another anyway. For starters my table structure is the following:
So I have these three models, as well as bunch more similar to
measure
, and themutation
object which does essentially what its name would suggest - track changes made to a given object, and the problem here is that, unlike the regular polymorphic relationships,object_type
isn't stored inmutation
, but undermutation_type.affected_model
, would there be any way of doing amorphTo('object', WHAT_TO_PUT_HERE, 'object_id')
that allows me to make use of Laravel's polymorphic relationships?Beta Was this translation helpful? Give feedback.
All reactions