php - Laravel 4 Pagination Buttons Not Working (Querying entire DB) -


i'll start saying i've consulted laravel 4 documentation on pagination , tried many methods work.

i using eloquent laravel 4's pagination class.

problem: in results page, i'm trying paginate results we'll call "trucks" db. works fine , want @ first (a limit of 5 results). problem when click 1 of page numbers (which don't appear accurate) created pagination, whole db queried , takes me wrong page. i'm using clauses , 3 dropdowns limit searcher's results pagination screws up. here's @ controller logic:

$results = $query->paginate(5);     return view::make('results')->with('trucks', $results); 

blade template

@if ($trucks)      @foreach ($trucks $truck) 

{{ $trucks->link() }}

how can make sure page numbers work correctly , don't query entire db? in advance.

i think might have use appends() method.

$trucks->appends(array('sort' => 'votes'))->links()

this work laravel 4 suppose using.

more info appends method here


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -