I have a query with eager loaded results that need to be sorted. I've used similar code in other areas of my site, but for some reason this isn't working.
$songs = SongGroup::with('song_status')
->with(array('group_songs' => function($group_song_query)
{
$group_song_query->orderBy('sort_no', 'asc');
}))
->where('show_id', '=', $id)
->orderBy('sort_no')
->get();
The orderBy in $group_song_query isn't sorting. When I say "isn't sorting", I mean that it isn't sorting the integer field called sort_no at all.
Is there something wrong with this that I'm not seeing?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community