Automatic records chunking

Similar to each() method, but easier to use. Automatically splits the result into parts (chunks).

return User::orderBy('name')->chunkMap(fn ($user) => [
'id' => $user->id,
'name' => $user->name,
]), 25);

Tip given by @PascalBaljet

Recent New Courses