From f439040375ce421fa14df18092153cd542eea0b2 Mon Sep 17 00:00:00 2001 From: tokumeikoi Date: Mon, 11 Apr 2022 11:30:53 +0800 Subject: [PATCH] update: ticket save lock --- app/Http/Controllers/User/TicketController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/User/TicketController.php b/app/Http/Controllers/User/TicketController.php index ea60e4c7..cad1a8c7 100644 --- a/app/Http/Controllers/User/TicketController.php +++ b/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([