Apply Pagination in Laravel
File: users.blade.php
<!DOCTYPE html>
<html>
<head>
<title>All Users</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<x-sidebar />
<br>
<div class="content">
<div class="row">
<div class="col-1"></div>
<div class="col-10">
<table class="table table-bordered border-primary">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">FULL NAME</th>
<th scope="col">EMAIL</th>
<th scope="col">CREATED</th>
</tr>
</thead>
<tbody>
@foreach($user as $rec)
<tr>
<th scope="row">{{$rec->id}}</th>
<td>{{$rec->name}}</td>
<td>{{$rec->email}}</td>
<td>{{$rec->created_at}}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="row">
<div class="col-3"></div>
<div class="col-6">
<a href="{{$user->previousPageUrl()}}"> <button class="btn btn-dark">Previous</button> </a>
<a href="{{$user->nextPageUrl()}}"> <button class="btn btn-primary">Next</button> </a>
</div>
<div class="col-3"></div>
</div>
</div>
<div class="col-1"></div>
</div>
</div>
</body>
</html>