So I'm new to laravel and I want to know how to make pagination work, in my controller I have this in the index
$users = Villa::with('City','Seller', 'Payment')->simplePaginate(3);
and for the blade, pagination nav
<nav aria-label="..." >
<ul >
<li aria-current="page" >
<span >1</span>
</li>
<li ><a href="">2</a></li>
<li ><a href="">3</a></li>
</ul>
</nav>
the goal is when I click on the (next page) I want it to route me to the rest of the data
what shall I do next ...
CodePudding user response:
Simply put this {{ $users->links() }}
where you want to show your pagination. It will work automatically.
CodePudding user response:
add this line at the bottom of your data :
{{ $users->links }}