davy_yg
1 month ago
174
10
Laravel

Chunk

Posted 1 month ago by davy_yg

Hello,

What this means:

DB::table('users')->orderBy('id')->chunk(100, function ($users) {
        foreach ($users as $user) {
            //
        echo $user;
        }
});

Processing 100 records at a time? Printing 100 user at a time?

How about the row 101 etc. ? Will it print them?

ref: https://laravel.com/docs/6.x/queries#chunking-results

Please sign in or create an account to participate in this conversation.