wesside wesside - 7 months ago 53
PHP Question

Laravel Eloquent ORM Transactions

The Eloquent ORM is quite nice, though I'm wondering if there is an easy way to setup MySQL transactions using innoDB in the same fashion as PDO, or if I would have to extend the ORM to make this possible?


You can do this:


Everything inside the Closure executes within a transaction. If an exception occurs it will rollback automatically.

Discussed in more detail here.