【发布时间】:2017-10-23 20:40:21
【问题描述】:
我在悲观锁定中看到了大多数使用查询构建器的示例,如下所示。
DB::table('users')->where('votes', '>', 100)->lockForUpdate()->get();
如何在 laravel 中通过 Eloquent 使用悲观锁?
【问题讨论】:
-
使用事务..好吧,您可以在stackoverflow中挖掘示例..不,我不是反对你的人..
-
你用 eloquent
User::where('votes', '>', 100)->lockForUpdate()->get();测试了你得到了什么??