Skip to content

Conversation

@techmahedy
Copy link
Member

Split a collection into smaller chunks of a specified size.

Example usages:

// Process large dataset in batches
$users = User::all(); // 1000 users
$batches = $users->chunk(100);

foreach ($batches as $batch) {
    // Process 100 users at a time
}

// Create pages for display
$products = Product::all();
$pages = $products->chunk(20); // 20 items per page

@techmahedy techmahedy merged commit cd1147a into doppar:3.x Jan 22, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant