repulsor's avatar

Pagination and all()

I am trying to fetch all rows from a table, and use pagination, but seems like

  $category = ProductCategory::all()->paginate(15);

Cant be done as it returns a collection.

What is the right way of retrieving all results and using pagination.

Is it must that I should use a where()? and what condition should I use?

0 likes
1 reply
chatty's avatar
chatty
Best Answer
Level 4

you don't need all at all

  $category = ProductCategory::paginate(15);

Please or to participate in this conversation.