See if this helps:
http://laravel.io/forum/05-12-2015-has-many-through-relationship-depth
Nov 4, 2015
4
Level 6
How to create hasManyThrough?
I have an object called SurveyInterview. This Object has a field called "current_step_id"
I have another object called SurveyUsedQuestions which have a column called question_id and a column called step_id.
Finally I have a third object called SurveyQuestions.
I need to add a hasManyThrough onto my SurveyInterview object which will allow me to access the questions object.
If I was to represent what I need with a query I would do this
SELECT questions.*
FROM interviews
INNER JOIN used_questions ON used_questions.step_id = interview.current_step_id
INNER JOIN questions ON question_id = used_questions.question_id
if hasManyThrough relation the right was to do this or is there another way I would need to do to build this relation?
Please or to participate in this conversation.