【发布时间】:2018-01-04 04:21:03
【问题描述】:
我有这个原始查询。 我怎样才能把这个转换成 Laravel eloquent。
SELECT * FROM `results` AS q
INNER JOIN `answers`AS a ON q.question_id = a.question_id
AND q.team1 = a.team1
AND q.team2 = a.team2
AND q.score1 = a.score1
// Table relationships.
results hasMany answers.
results hasMany predictions.
Prediction is another model here.
【问题讨论】:
-
results和answers是什么关系? -
results有很多答案,答案属于结果。 @BalrajAllam