laravel query get big table records code example
Example: laravel query get big table records
#METHOD 1
DB::table('users')->orderBy('id')->chunk(100, function ($users) {
foreach ($users as $user) {
//
}
});
#METHOD 2
foreach (DB::table('users')->orderBy('id')->cursor() as $flight) {
//
}