📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Laravel Framework Pagination

Pagination

4 min read
Paginate results with paginate(), simplePaginate(), or cursorPaginate() and render navigation links.

Pagination

// Eloquent pagination
$posts = Post::latest()->paginate(10);          // with total count
$posts = Post::latest()->simplePaginate(10);    // prev/next only
$posts = Post::latest()->cursorPaginate(10);    // most efficient

// In Blade
{{ $posts->links() }}  // Bootstrap pagination links

// Customize view
{{ $posts->links("vendor.pagination.tailwind") }}

// API — returns JSON with meta and links
return PostResource::collection(Post::paginate(10));
// {
//   "data": [...],
//   "links": { "first": "...", "next": "..." },
//   "meta": { "current_page": 1, "total": 100 }
// }

// Manual page
$page = request("page", 1);
Post::skip(($page - 1) * 10)->take(10)->get();