Database Inheritance Relationship #35898
Unanswered
juliomotol
asked this question in
Q&A
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to implement a database inheritance relationship similar to this.
For my use case, I have a
questions
table with different types but they share some properties.Further down the line, we will be adding more question types such as identification, true or false, enumeration, etc.
For now, what I've done is add polymorph columns on questions table and use that to determine the question type.
But my problem with this is by adding morphs to the
Question
model, it is now the child ofMultipleChoice
, but it should be the other way around.What I aim to achieve is to allow the parent model to have more than one type of model association.
You may say I could just declare multiple relationships for the
Question
But only I want a question record to strictly have one type.
Any ideas to do this?
Beta Was this translation helpful? Give feedback.
All reactions