Using manually pagination in Laravel 5.1

Using manually pagination in Laravel 5.1 5.00/5 (100.00%) 1 vote

Recently I had necessity to use pagination in Laravel 5 without usage of Eloquent (it’s a legacy project which is being rewritten to laravel, so it’s using Propel orm and not Eloquent).

As turned out it’s quiet easy anyway (although documentation is not really great about this particular subject).


Little explanation for code above:

  • $max = maximum results per page
  • $total = total results
  • $comments = your array of data
  • $currentPage = page currently requested (defaults to 1).
  • $paginator->setPath() = set’s the path for newly generated links. Without this parameter all links in paginator were going to

Then in your template

And that’s pretty much all.

2 Responses

  1. Shanaka Perera scrive:

    Great Work dude…. (Y)

  2. Nasir scrive:

    Can you please give me full code as I could not find $request variable , where from i can find that or how can I set it.

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *

È possibile utilizzare questi tag ed attributi XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">