G
G
GaserV2017-05-18 22:53:23
Laravel
GaserV, 2017-05-18 22:53:23

How to set a limit on the number of pages displayed in pagination?

Hi all! I use default pagination out of the box. Displays all pages. Can I limit the number of pages displayed, say only 10? And how?)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stanislav Pochepko, 2017-05-19
@DJZT

You can set the limit of selected entries to 100 pcs and then you will have 100/10 = 10 pages
$users = User::take(100)->paginate(10);

G
GaserV, 2017-05-19
@GaserV

In general, this tutorial helped to solve the problem: amsify42.com/blog/post/custom-pagination-in-laravel-5

S
shelomanovd, 2017-05-21
@shelomanovd

simplePaginate(10);
// или лимит 
take(10); skip(10)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question