From 88b1ecd0b36c62f375af33c2f49fdef24cedfc4e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 23 Jan 2015 11:00:52 -0600 Subject: [PATCH] Document chunk. --- queries.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/queries.md b/queries.md index 4b68765d1b..c1c2854bc4 100644 --- a/queries.md +++ b/queries.md @@ -31,6 +31,25 @@ The database query builder provides a convenient, fluent interface to creating a var_dump($user->name); } +#### Chunking Results From A Table + + DB::table('users')->chunk(100, function($users) + { + foreach ($users as $user) + { + // + } + }); + +You may stop further chunks from being processed by returning `false` from the `Closure`: + + DB::table('users')->chunk(100, function($users) + { + // + + return false; + }); + #### Retrieving A Single Row From A Table $user = DB::table('users')->where('name', 'John')->first();