Skip to content

Add chunk method to query builder - #3

Open
praem90 wants to merge 2 commits into
adreastrian:masterfrom
praem90:feature/add-chunk-method
Open

Add chunk method to query builder#3
praem90 wants to merge 2 commits into
adreastrian:masterfrom
praem90:feature/add-chunk-method

Conversation

@praem90

@praem90 praem90 commented Nov 27, 2021

Copy link
Copy Markdown

Add a chunk helper method to work with large tables

$file = fopen("php://output", 'w');
$query = DB::table('my_table')->chunk(100, function ($records) use ($file) {
	foreach($records as $record) {
		fputcsv($file, $record);
	}
});
fclose($file);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant