1
我想命令Laravel 5.4中的morphTo关系的结果。下面的例子不起作用。在其他关系(例如hasMany())上添加orderBy方法确实有效。Laravel 5.4 orderBy上morphTo关系
class OrderLineItem extends Model
{
public function eventtable()
{
return $this->morphTo()->orderBy('date');
}
}
我已经能够通过在集合上使用sortBy对查询后的结果集进行排序。但是在查询中排序结果会很好。 date col总是在多态相关表中可用。
谢谢,但这是行不通的。 – Raiserweb