efcoders's avatar

Custom pagination in laravel5

Hi All is there any simple example of custom pagination in laravel5?

Thnaks

0 likes
13 replies
willvincent's avatar

@efcoders look at the BootstrapThreePresenter.php and SimpleBootstrapThreePresenter.php files that ship with laravel 5 for example code.

Really, just look at the entire Pagination directory: vendor/laravel/framework/src/Illuminate/Pagination

efcoders's avatar

well to be honest i am new on laravel..any guy can give me some link or tell me step by step how to implement this .... Thanks

efcoders's avatar

I tried @bestmomo's solutio but now i am getting

BindingResolutionException in Container.php line 872: Unresolvable dependency resolving [Parameter #0 [ $items ]] in class Illuminate\Pagination\Paginator

error..

can any one please suggest?

Thanks

1 like
matthewlocal's avatar

I know it's a year late! but I got it working using this method:

use Illuminate\Pagination\Paginator;

class someController extends Controller {

public function someFunction(){
    $results = array();
    $ready = new Paginator($results, 10);
    dd($ready);
}

}

jlrdw's avatar

Really with a little bit of digging around in PHP forums, a paginator is simple to write.

matthewlocal's avatar

@ bashy yes, but it feels a bit messy. @jlrdw you are right and it's not difficult but if it exists in the framework use it :) just to save time.

jlrdw's avatar

@max101 that statement is kind of a paradox, it seems like the majority of laravel users end up pulling in external packages to do things, like some will pull in data tables where as I write my own HTML tables. An example I recently did a project that had inline editing, but I used a regular PHP / html table.
This http://laravel.io/forum/11-13-2014-laravel-5-pagination Still works.

Please or to participate in this conversation.