wesside wesside - 1 year ago 273
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download