$count = 0;
DB::table('users')->chunk(200, function($users) use (&$count)
{
Log::debug(count($users)); // will log the current iterations count
$count = $count + count($users); // will write the total count to our method var
});
Log::debug($count); // will log the total count of records
## https://laravel.com/docs/eloquent#chunking-results
use AppModelsFlight;
Flight::chunk(200, function ($flights) {
foreach ($flights as $flight) {
//
}
});