DB::beginTransaction(); try { // Do some database queries DB::table('users')->update(['active' => true]); DB::table('orders')->where('status', 'pending')->update(['status' => 'complete']); DB::commit(); } catch (\Throwable $e) { DB::rollBack(); throw $e; }In this example, we are updating the `users` table and the `orders` table within a transaction. If either of those updates fail, the entire transaction will be rolled back and no changes will be made to the database. This code example is a part of the Illuminate package library that comes bundled with Laravel.