DevBlog

Coding my way

1 year ago in Laravel · 0 MIN READ

Bootstrap 4 pagination in Laravel 5.2

It's been bugging me, and all the sources I've found handled this is a convoluted way...

Here's the simple solution:

Use pagination as usual:

/**
 * Display a listing of the resource.
 *
 * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 */

public function index()
{
  return view('pages.guestbook', ['entries' => GuestbookEntry::orderBy('created_at', 'DESC')->paginate(25)]);
}

and in the blade template:

{!! $entries->render(new \Illuminate\Pagination\BootstrapFourPresenter($entries)) !!}

If you want to create your own pagination presenter, check out Codecourse's video

···

Miklós Galicz

I'm a hobbyist who managed to become a professional web developer who specializes in Laravel and Vue.js, also the Spice must flow.
comments powered by Disqus


© 2017 DevBlog