Level 4
Seems like SQL Server requires a workaround suggested by staudenmeir. This isn't beautiful, but it worked for me.
https://github.com/laravel/framework/issues/30119#issuecomment-536071521
Hi, I'm trying to sort my collection with pagination by relation count. The first page ist working fine, all other pages are showing following Error: Invalid column name 'live'.
Does anyone have a solution for this?
My Code:
$events = Event::withCount([
'tags as live' => function ($query) {
$query->where('tag_id', 11342);
}
])
->orderBy('live', 'desc')
->paginate(5);
Seems like SQL Server requires a workaround suggested by staudenmeir. This isn't beautiful, but it worked for me.
https://github.com/laravel/framework/issues/30119#issuecomment-536071521
Please or to participate in this conversation.