Game-Jaming/Backend/Controllers/Polls/1vote.php

28 lines
381 B
PHP
Raw Normal View History

2021-03-05 12:00:07 +00:00
<?php
use Backend\Models\Group;
use Backend\Models\Vote;
2021-03-08 12:01:01 +00:00
require "../../../bootstrap.php";
2021-03-05 12:00:07 +00:00
if(isset($_POST['1Vote'])){
2021-03-05 12:00:07 +00:00
require "VoteChecking.php";
$vote = new Vote();
$vote->group()->associate(Group::find($_POST['groupId']));
$vote->points += 1;
if(!empty($_POST['comment'])){
$vote->comment = $_POST['comment'];
}
$vote->save();
}