write query in laravel code example
Example 1: laravel chunk select
DB::table('users')->chunk(100, function($users)
{
foreach ($users as $user)
{
//
}
});
Example 2: TRANSACTON LARAVEL QUERY BUILDER
DB::beginTransaction();
try {
DB::insert(...);
DB::commit();
} catch (\Throwable $e) {
DB::rollback();
throw $e;
}