I'll start by saying i've already consulted the Laravel 4 documentation on Pagination and tried many methods to get this to work.
I am using Eloquent together with Laravel 4's Pagination class.
Problem: In my results page, i'm trying to paginate my results for what we'll call "trucks" DB. It works fine and I get exactly what I want at first (a limit of five results). Problem is when I click one of the page numbers (which don't appear to be accurate) created by pagination, the whole DB is queried and it takes me to the wrong page. I'm using where clauses and three dropdowns to limit the searcher's results but the pagination screws all that up. Here's a look at my controller logic:
$results = $query->Paginate(5);
return View::make('results')->with('trucks', $results);
Blade Template
@if ($trucks)
@foreach ($trucks as $truck)
{{ $trucks->link() }}
How can I make sure that the page numbers work correctly and don't query the entire DB? Thanks in advance.