how to return chunk data laravel

Solutions on MaxInterview for how to return chunk data laravel by the best coders in the world

showing results for - "how to return chunk data laravel"
Alejandro
10 Sep 2018
1$count = 0;
2DB::table('users')->chunk(200, function($users) use (&$count)
3{
4    Log::debug(count($users)); // will log the current iterations count
5    $count = $count + count($users); // will write the total count to our method var
6});
7Log::debug($count); // will log the total count of records