I have two tables :
profiles table
+----+-------+--------+
| id | title | verify |
+----+-------+--------+
And profile_followers table
+------------+---------+
| profile_id | user_id |
+------------+---------+
I want to get profile list with orderBy count followers together cursorPaginate in Laravel
I use this code :
$profile = Profile::where('verify', '=', 1)
->withCount('followers')
->orderBy('followers_count', 'desc')
->cursorPaginate(20);
I get the first 20 rows, but when I try to return the next 20 rows with Cursor(nextPageUrl), an error like this occurs:
Column not found: 1054 Unknown column 'followers_count' in 'where clause'
It works with Paginate, but not with cursorPaginate.