use Illuminate\Support\Facades\DB; DB::beginTransaction(); try { // Some database queries DB::commit(); } catch (\Exception $e) { DB::rollBack(); }In this example, a database transaction is initiated using the beginTransaction method of the DB facade. Then, some database queries are executed, and if an exception occurs, the transaction is rolled back using the rollBack method. Package Library: Laravel Framework.