Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

HFH's avatar
Level 1

Laravel 5.5 & Bootstrap 4 Pagination Issues

I've seen a number of threads regarding the class changes in pagination from BS3 to BS4, but I can't seem to get to the bottom of it on my own app.

Using a simple pagination in my controller with:

$users = DB::table('users')->orderBy('created_at', 'desc')->simplePaginate(5);

And then rendering the pagination buttons as such:

{{ $users->render() }}

Gives me unstyled links, instead of normal buttons.

0 likes
7 replies
jdunsmore's avatar

Can you explain why you're using

{{$users->render()}}

Instead of

{{$users->links()}}

?

skeith22's avatar

use

{{ $users->links('vendor.pagination.bootstrap-4') }}

you're welcome

Maung-C's avatar

Change your controller.php $users = DB::table('users')->orderBy('created_at', 'desc')->simplePaginate(5); to $users = DB::table('users')->orderBy('created_at', 'desc')->paginate(5);

and then you can use {{ $users->render() }} or {{ $users->links() }} for your view pagination simplePaginate() method is show next and previous link only.

mballaag's avatar

@HFH @MustafaAgamey use

 {{ $users->links() }} 

Remember, the HTML generated by the links method is compatible with the Bootstrap CSS framework

1 like
pardeepkumar's avatar

For Controller

public function index()
    {
        $users = DB::table('users')->paginate(15);

        return view('user.index', ['users' => $users]);
    }

For View


    @foreach ($users as $user)
        {{ $user->username }}
    @endforeach

{{ $users->links() }}

Please or to participate in this conversation.