Laravel - Getting Started - Manually Using Transactions

If you would like to begin a transaction manually and have complete control over rollbacks and commits, you may use the beginTransaction method provided by the DB facade:

    use Illuminate\Support\Facades\DB;

You can rollback the transaction via the rollBack method:


Lastly, you can commit a transaction via the commit method:

The DB facade's transaction methods control the transactions for both the query builder and Eloquent ORM.