我有一个有许多Action的Objective模型,每个Action都有一个ActionYear。已经在模型中定义。Laravel雄辩的关系orderby问题
如何使用orderby通过action_year的特定列对目标中的操作进行排序。
$query = Objective::with('actions.actionYear')
->orderBy('action_year.created_at')
->get();
这通过错误Undefined table: 7 ERROR: missing FROM-clause entry for table "action_year"
。 如何解决这个问题。谢谢。
仍然有同样的问题。 –
但即使是右桌也是'action_year'? – lukasgeiter
是'action_year'。我有三层 - 客观 - >行动 - > action_year' –