D
D
Dmitry Chekanov2016-09-20 13:13:00
Laravel
Dmitry Chekanov, 2016-09-20 13:13:00

How to get pagination of not all records from the database?

When paginating, all records are taken from the database. But you need to take for example 500 records, and the following code does not work. Tell me how to be.
Note::query()
->where ('published', 1)
->take (500)
->paginate(100);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2016-09-20
@Sanasol

During pagination, N records are retrieved from the database, which are specified in paginate(N)
What do you want to do? To not be able to scroll to the latest entries?
Then filter by some parameter so that it gives out the necessary records, and not all.

O
Omniverse, 2016-09-20
@Omniverse

Try using the total method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question