Hi, I need help with paginating my database.
Basically, I want to do a complete query from my DB, and I want to chunk it off so that only certain sections of it are given at a time - the rest can be scrolled through via pagination.
$dairies = DB::table('dairies') select('name', 'stock') ->get();
This would return every entry in the 'dairies' table, all 20,000+ of them.
I know of the "->paginate(num)" extension I can add to my DB::table, like so instead of 'get':
But what I need to do isn't simply to paginate the result. I need to spread it out so that, rather than load all 100,000+ entries in the DB, I only load, say, 50 at a time, and hitting the 'next' or 'previous' button will get the next batch of 50 after that.
Does anyone know how to do this? If you could spare the time, your help would be greatly appreciated!