The guys at Laravel have done a great job and with Laravel 5 is super easy to get Pagination working in 2 mins flat (I promise!). Also the default syntax is Bootstrap (but you can change to custom if you want pretty easily).
In Controller:
1 2 3 |
$data["users"] = User->paginate(2); |
In view:
Loop through collection:
1 2 3 4 5 |
@foreach( $users->getCollection()->all() as $user ) {{ $user->name }} @endforeach |
Output bootstrap pagination links:
1 2 3 |
<?php echo $users->appends(Request::except('page'))->render(); ?> |
Links:
https://laravel.com/docs/5.0/pagination
https://laracasts.com/lessons/crazy-simple-pagination