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
|
|
|
|
|
|
|
|
2021-03-11 08:28:30 +00:00
|
|
|
if(isset($_POST['321Vote'])){
|
2021-03-05 12:00:07 +00:00
|
|
|
require "VoteChecking.php";
|
|
|
|
|
|
|
|
//give 1 point
|
|
|
|
$vote = new Vote();
|
|
|
|
$vote->group()->associate(Group::find($_POST['1pGroupId']));
|
|
|
|
$vote->points += 1;
|
|
|
|
if(!empty($_POST['1pComment'])){
|
|
|
|
$vote->comment = $_POST['1pComment'];
|
|
|
|
}
|
|
|
|
$vote->save();
|
|
|
|
//give 2 point
|
|
|
|
$vote = new Vote();
|
|
|
|
$vote->group()->associate(Group::find($_POST['2pGroupId']));
|
|
|
|
$vote->points += 2;
|
|
|
|
if(!empty($_POST['2pComment'])){
|
|
|
|
$vote->comment = $_POST['2pComment'];
|
|
|
|
}
|
|
|
|
$vote->save();
|
|
|
|
//give 3 point
|
|
|
|
$vote = new Vote();
|
|
|
|
$vote->group()->associate(Group::find($_POST['3pGroupId']));
|
|
|
|
$vote->points += 3;
|
|
|
|
if(!empty($_POST['3pComment'])){
|
|
|
|
$vote->comment = $_POST['3pComment'];
|
|
|
|
}
|
|
|
|
$vote->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|