Get Group

This commit is contained in:
2021-03-11 11:13:06 +01:00
parent a65e9ceec8
commit bc2befce97
2 changed files with 17 additions and 2 deletions
+16
View File
@@ -0,0 +1,16 @@
<?php
require_once "../../../bootstrap.php";
use Backend\Models\Group;
if (isset($_POST["GroupId"])){
$groups = Group::find($_POST["GroupId"]);
}
elseif(isset($_POST["gameJameId"])){
$groups = Group::where("game_jam_id",$_POST["gameJameId"]);
}
else{
$groups = Group::all();
}
header('Content-Type: application/json;charset=UTF-8');
echo $groups->toJson(JSON_PRETTY_PRINT);
@@ -0,0 +1,18 @@
<?php
require_once "../../../bootstrap.php";
require_once "../Admin/Admin.php";
use Backend\Models\Group;
session_start();
if(isAdmin()){
if(isset($_POST['restPassword'])){
$group = Group::find($_POST['groupId']);
if($group){
$group->password->password = password_hash($_POST['newPassword'], PASSWORD_DEFAULT);
if($group->save()){
}
}
}
}