Laravel雄辩的ORM交易

Laravel雄辩的ORM交易

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?推荐答案您可以执行以下操作:DB::transaction(function() { //});关闭过程中的所有操作都在事务中执行.如果发生异常,它将自动回滚.Everything inside the Closure executes within a transaction. If an exception occurs it will rollback automatically. 这篇关于Laravel雄辩的ORM交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-22 18:27