Browse Source

Only commit DB transaction after voting code is set to used

master
Les De Ridder 1 year ago
parent
commit
5b68c912d1
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      app/Http/Controllers/PollController.php

+ 1
- 1
app/Http/Controllers/PollController.php View File

@@ -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);
}

Loading…
Cancel
Save