0
나는 many-to-many 관계가있는 데이터베이스를 몇 개 가지고있다. 나는 결과이 같은 알파벳 순서로 정렬하고 싶은many-to-many 관계의 결과를 정렬 (order_by) 할 수 있습니까?
public function tags()
{
return $this->belongsToMany('Tag', 'user_tag')->withPivot('otherStuff');
}
public function tags()
{
return $this->belongsToMany('Tag', 'user_tag')->withPivot('otherStuff')->order_by('name', 'asc');
}
내가 그 코드를 시도 ... 그래서 같은 모델에서 그들을 연결하지만, Laravel있다 4 실패하고 order_by가 존재하지 않는다고 불평했다. 어떤 제안?