You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve set up a Model and a GlobalFields table. The GlobalFields table includes a model_type field, which contains the morph class name—but without the actual model id, since these fields are intended to be shared across different model types.
What I’d like to do is load all related GlobalFields records by calling $model->globalFields, with support for eager loading as well.
Is there a way to achieve this using a relation, maybe with a workaround?
I’ve tried something along these lines, but it didn’t work:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there!
I’ve set up a Model and a GlobalFields table. The GlobalFields table includes a model_type field, which contains the morph class name—but without the actual model id, since these fields are intended to be shared across different model types.
What I’d like to do is load all related GlobalFields records by calling $model->globalFields, with support for eager loading as well.
Is there a way to achieve this using a relation, maybe with a workaround?
I’ve tried something along these lines, but it didn’t work:
Best - Alex
Beta Was this translation helpful? Give feedback.
All reactions