Game-Jaming/Backend/Controllers/Polls/GetVote.php

16 lines
403 B
PHP
Raw Normal View History

2021-03-11 12:21:16 +00:00
<?php
2021-04-19 07:15:15 +00:00
2021-03-11 12:21:16 +00:00
use Backend\Models\Vote;
2021-04-19 07:15:15 +00:00
2021-03-16 11:46:44 +00:00
require_once "../../../bootstrap.php";
2021-03-11 12:21:16 +00:00
require_once "../Group/Group.php";
2021-04-19 07:15:15 +00:00
if (isLogin()) {
2021-03-11 12:21:16 +00:00
header('Content-Type: application/json;charset=UTF-8');
2021-04-19 07:15:15 +00:00
echo json_encode(array('data' => Vote::where('group_id', groupViaToken($_SESSION['token'])->id)->get()->jsonSerialize()));
2021-03-11 12:21:16 +00:00
2021-04-19 07:15:15 +00:00
} else {
2021-03-23 12:39:44 +00:00
http_response_code(401);
echo json_encode(["message" => "not login"]);
2021-03-11 12:21:16 +00:00
}