mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-05 10:11:25 -05:00
Redirect to result when user has already voted
This commit is contained in:
@@ -45,6 +45,12 @@ class PollController extends Controller
|
||||
public function show($slug)
|
||||
{
|
||||
$poll = Poll::whereSlug($slug)->firstOrFail();
|
||||
$user = auth()->user();
|
||||
$user_has_voted = $poll->voters->where('user_id', $user->id)->isNotEmpty();
|
||||
|
||||
if ($user_has_voted) {
|
||||
return $this->result($slug);
|
||||
}
|
||||
|
||||
return view('poll.show', compact('poll'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user