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

16 lines
386 B
PHP

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