0, 'drops' => 0, ]; $rate = config('drops.module_rate'); Module::chunk( 100, function ($modules) use ($default, $rate) { foreach ($modules as $module) { $data = [ 'transactions' => [ 'this_month' => Cache::get('this_month_balance_and_drops_' . $module->id, $default), 'last_month' => Cache::get('last_month_balance_and_drops_' . $module->id, $default), ], 'rate' => $rate, ]; (new ModuleEarnings($module)) ->toGroup($data); } } ); } }