1. Go to this page and download the library: Download do6po/laravel-cursor-chunk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$builder = User::query();
//... some code with builder
foreach ($builder->cursorChunk() as $users) {
//some action with $users
}
use Illuminate\Database\Eloquent\Collection;
$builder = User::query();
//... some code with builder
$action = fn(Collection $users, User $user) => $users->put($user->getKey(), $user);
foreach ($builder->cursorChunk(1000, $action) as $users) {
//some action with $users, chunked by 1000 models and key by id
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.