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.
same issue , any solutions ?
Can you explain why you're using
{{$users->render()}}
Instead of
{{$users->links()}}
?
use
{{ $users->links('vendor.pagination.bootstrap-4') }}
you're welcome
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.
@HFH @MustafaAgamey use
{{ $users->links() }}
Remember, the HTML generated by the links method is compatible with the Bootstrap CSS framework
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 sign in or create an account to participate in this conversation.