User::chunk(100, function ($users) { foreach ($users as $user) { $some_value = ($user->some_field > 0) ? 1 : 0; // might be more logic here $user->update(['some_other_field' => $some_value]); } });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter