From 6fe496c8ec780bcf0d806d0d14be0fb660c1c36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=8B=E3=82=AB=E3=83=AB=E8=AB=8F?= =?UTF-8?q?=E8=A8=AA=E5=AD=90?= Date: Fri, 1 Feb 2019 18:19:04 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=94=E3=83=B3=E3=81=A8=E3=83=AD=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/BoardController.php | 26 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/BoardController.php b/app/Http/Controllers/BoardController.php index 9dc79b9..bb8f4a2 100644 --- a/app/Http/Controllers/BoardController.php +++ b/app/Http/Controllers/BoardController.php @@ -947,11 +947,18 @@ class BoardController extends Controller { $valid = $this->objAuth->getPermissions($request->username, $request->password); if ($valid['for_locky'] == 1) { - return DB::table('for_threads') + $s = DB::table('for_threads') + ->select('lock') + ->where('id', $request->id) + ->first(); + + DB::table('for_threads') ->where('id', $request->id) ->update([ - 'lock' => 1 - ]); + 'lock' => ($s->lock == 0 ? 1 : 0) + ]); + + return ($s->lock == 0 ? 1 : 0); } else { return 'Permission denied.'; @@ -1170,11 +1177,18 @@ class BoardController extends Controller { $valid = $this->objAuth->getPermissions($request->username, $request->password); if ($valid['for_sticky'] == 1) { - return DB::table('for_threads') + $s = DB::table('for_threads') + ->select('sticky') + ->where('id', $request->id) + ->first(); + + DB::table('for_threads') ->where('id', $request->id) ->update([ - 'sticky' => 1 - ]); + 'sticky' => ($s->sticky == 0 ? 1 : 0) + ]); + + return ($s->sticky == 0 ? 1 : 0); } else { return 'Permission denied.';