浏览代码

update: ticket save lock

tokumeikoi 3 年之前
父节点
当前提交
f439040375
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      app/Http/Controllers/User/TicketController.php

+ 1 - 1
app/Http/Controllers/User/TicketController.php

@@ -55,7 +55,7 @@ class TicketController extends Controller
     public function save(TicketSave $request)
     {
         DB::beginTransaction();
-        if ((int)Ticket::where('status', 0)->where('user_id', $request->session()->get('id'))->count()) {
+        if ((int)Ticket::where('status', 0)->where('user_id', $request->session()->get('id'))->lockForUpdate()->count()) {
             abort(500, __('There are other unresolved tickets'));
         }
         $ticket = Ticket::create(array_merge($request->only([