Game-Jaming/Backend/Controllers/Group/GetGroup.php

16 lines
386 B
PHP
Raw Normal View History

2021-03-11 10:13:06 +00:00
<?php
require_once "../../../bootstrap.php";
use Backend\Models\Group;
2021-03-11 12:21:16 +00:00
if (isset($_GET["groupId"])){
$groups = Group::find($_GET["groupId"]);
2021-03-11 10:13:06 +00:00
}
2021-03-11 12:21:16 +00:00
elseif(isset($_GET["gameJameId"])){
$groups = Group::where("game_jam_id",$_GET["gameJameId"])->get();
2021-03-11 10:13:06 +00:00
}
else{
$groups = Group::all();
}
header('Content-Type: application/json;charset=UTF-8');
echo $groups->toJson(JSON_PRETTY_PRINT);