瀏覽代碼

Only commit DB transaction after voting code is set to used

master
Les De Ridder 3 年前
父節點
當前提交
5b68c912d1
  1. 2
      app/Http/Controllers/PollController.php

2
app/Http/Controllers/PollController.php

@ -275,7 +275,6 @@ class PollController extends Controller
$vote->poll_option_id = $option;
$poll->votes()->save($vote);
}
DB::commit();
if($poll->duplicate_vote_checking == 'cookies') {
$request->session()->put($poll->id, null);
@ -285,6 +284,7 @@ class PollController extends Controller
$code->used = true;
$code->save();
}
DB::commit();
return redirect()->action('PollController@viewResults', ['poll' => $poll])->with('voted', true);
}

載入中…
取消
儲存