I have a pagination and try to limit the amount of pages for that pagination. Every page has 50 results and the maximum amount of pages I want for this pagination is 200 (10k total entries from the table). I tried the following:
$page_count = 50;
$users = DB::Table('user_totalpoints')->where('points', '>', 0)
->orderBy('points', 'desc')
->orderBy('id', 'asc')
->take(10000)
->paginate($page_count);
The result of this is a pagination with 50 results per page but with ALL entries from the user_totalpoints table. take(10000) is ignored as there are only 50 taken by the pagination. So instead of maximum 200pages I now have thousands.
How can I limit the amount of pages for my pagination in laravel?