'Laravel Livewire pagination with bootstrap links not displaying
I'm using Laravel Livewire with bootstrap 4. I'm trying to use pagination but the links aren't displaying at the bottom of the table. I don't think the issue is in my blade file or in the livewire component itself, as I can see in the response that there's no pagination links()
method available by doing this:
$x = User::paginate(5);
dd($x);
Which yields this result, and contains no reference to links
In my livewire component I'm including the trait: use WithPagination;
, and I'm also including the protected $paginationTheme = 'bootstrap';
line as well.
At the bottom of my div just after the table element I have included:
{{ $users->links() }}
Everything I'm doing seems to be "by the book" in terms of what the docs say, but the links just don't display. It's limiting the number of rows on the page as well, just no links.
Solution 1:[1]
On your Livewire component:
use Livewire\WithPagination;
Inside class use the trait:
use WithPagination;
Then set the pagination theme:
protected $paginationTheme = 'bootstrap';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | rargueso |