setDelimiter("|"); $csv->setEnclosure("'"); $csv->setHeaderOffset(0); $registros = $csv->getRecords(); $toInsert = []; foreach($registros as $registro){ $toInsert[] = [ 'nombre' => $registro['barrio'], 'region' => $registro['region'], 'telefono' => $registro['telefono'], 'correo' => $registro['correo'], 'referente_finanzas' => $registro['referente'] ]; } foreach (array_chunk($toInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk) { DB::table('grupos_de_compra')->insert($chunk); } } }