Eloquent and Transactions

I was wondering about how to properly implement transactions using eloquent. I would like each request to execute in a transaction so that on failure the DB is unchanged.

Is it enough to stick a beginTransaction() into the code after the initialization of Eloquent and then have an exception handler which does a rollback or do I have to be mindful of other things?

This may be helpful to you- the comment at the bottom. shrug

2 Likes

Very helpful. Thank you!