new database
This commit is contained in:
parent
24663071e6
commit
22a431da07
|
@ -1,12 +1,17 @@
|
|||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
|
||||
use \Backend\Models\GameData;
|
||||
use \Backend\Models\Group;
|
||||
use Backend\Models\Registration;
|
||||
|
||||
if (isset($_GET['gameDataId'])) {
|
||||
$openGameDataStream = GameData::find($_GET['gameDataId']);
|
||||
} elseif (isset($_GET['registrationId'])) {
|
||||
$openGameDataStream = Registration::find($_GET['registrationId']);
|
||||
} elseif (isset($_GET['groupId'])) {
|
||||
$openGameDataStream = Group::find($_GET['groupId'])->GameData();
|
||||
$registrationIds = Registration::where("group_id", $_GET['groupId'])->pluck("game_data_id")->toArray();
|
||||
$openGameDataStream = GameData::whereIn("id", $registrationIds)->get();
|
||||
} elseif (isset($_GET['gameJamId'])) {
|
||||
$gameDataIds = Group::where("game_jam_id", $_GET['gameJamId'])->pluck("game_data_id")->toArray();
|
||||
$openGameDataStream = GameData::whereIn("id", $gameDataIds)->get();
|
||||
|
|
|
@ -2,10 +2,26 @@
|
|||
require_once "../../../bootstrap.php";
|
||||
require_once('../Group/Group.php');
|
||||
require_once('FileHandler.php');
|
||||
|
||||
use Backend\Models\GameData;
|
||||
use Backend\Models\Registration;
|
||||
|
||||
if (isLogin()) {
|
||||
if (isset($_POST['submitUpdate'])) {
|
||||
//Get the game data
|
||||
$gameData = GameData::find($_POST['gameDataId']);
|
||||
if ($gameData === null) {
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "game data not found"]);
|
||||
exit();
|
||||
}
|
||||
//Get the group
|
||||
$group = groupViaToken($_SESSION['token']);
|
||||
if (!in_array($gameData->id, Registration::where("group_id", $group->id)->pluck("game_data_id")->toArray())) {
|
||||
http_response_code(401);
|
||||
exit();
|
||||
}
|
||||
|
||||
$gameFile = $_FILES['gameFile'];
|
||||
$desc = $_POST['description'];
|
||||
$title = $_POST['gameTitle'];
|
||||
|
@ -20,11 +36,6 @@ if(isLogin()){
|
|||
$thumbnailFileTmp = $_FILES['thumbnailFile']['tmp_name'];//Tmp location of the file
|
||||
$thumbnailFileError = $_FILES['thumbnailFile']['error'];//File error
|
||||
|
||||
|
||||
//Get the group
|
||||
$group = groupViaToken($_SESSION['token']);
|
||||
//Get the game data, from the group
|
||||
$gameData = GameData::find($group->game_data_id);
|
||||
$gameData->game_name = $title;
|
||||
if (isset($gameData) && $gameFileError === 0) {
|
||||
unlink("../../Games/" . $gameData->game_link);
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
require_once "../../../bootstrap.php";
|
||||
require_once('../Group/Group.php');
|
||||
require_once('FileHandler.php');
|
||||
|
||||
use Backend\Models\GameData;
|
||||
use Backend\Models\GameJam;
|
||||
use Backend\Models\Registration;
|
||||
|
||||
use Backend\Models\Group;
|
||||
|
||||
|
@ -13,10 +15,22 @@ $isImages = false;
|
|||
|
||||
|
||||
if (isLogin()) {
|
||||
|
||||
if (isset($_POST['submitUpload'])) {
|
||||
$group = groupViaToken($_SESSION['token']);
|
||||
$gameJam = GameJam::find($_POST['gameJamId']);
|
||||
if ($gameJam === null) {
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "gameJam not found"]);
|
||||
exit();
|
||||
}
|
||||
$registration = Registration::where('game_jam_id', $gameJam->id)->where("group_id", $group->id)->frist();
|
||||
if ($registration === null) {
|
||||
http_response_code(401);
|
||||
echo json_encode(["message" => "group not registered for that game jam"]);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$gameJam = GameJam::find($group->game_jam_id);
|
||||
$gameJamStartTime = strtotime($gameJam->start_time);
|
||||
$gameJamEndTime = strtotime($gameJam->end_time);
|
||||
$date = date('Y/m/d H:i:s', time());
|
||||
|
@ -24,8 +38,7 @@ if(isLogin()){
|
|||
$currentTime = strtotime($date);
|
||||
|
||||
if ($gameJamStartTime <= $currentTime && $gameJamEndTime >= $currentTime) {
|
||||
if(!isset($group->game_data_id)){
|
||||
if(isset($_POST['submitUpload'])){
|
||||
if (!isset($registration->game_data_id)) {
|
||||
//Get the data from the user form
|
||||
$gameFile = $_FILES['gameFile'];
|
||||
$desc = $_POST['description'];
|
||||
|
@ -51,8 +64,8 @@ if(isLogin()){
|
|||
}
|
||||
$gameData->is_web_Based = $isWebBased;
|
||||
$gameData->save();
|
||||
$group->gameData()->associate($gameData);
|
||||
if(! $group->save()){
|
||||
$registration->gameData()->associate($gameData);
|
||||
if (!$registration->save()) {
|
||||
http_response_code(500);
|
||||
} else {
|
||||
http_response_code(201);
|
||||
|
@ -63,15 +76,15 @@ if(isLogin()){
|
|||
}
|
||||
} else {
|
||||
http_response_code(400);
|
||||
}
|
||||
}else{
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "Can only upload one file"]);
|
||||
echo json_encode(["message" => "file already uploaded "]);
|
||||
}
|
||||
} else {
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "Can only upload when the game jam has started"]);
|
||||
}
|
||||
} else {
|
||||
http_response_code(400);
|
||||
}
|
||||
} else {
|
||||
http_response_code(401);
|
||||
echo json_encode(["message" => "is not login"]);
|
||||
|
|
|
@ -5,6 +5,7 @@ header("Access-Control-Max-Age: 1000");
|
|||
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Origin, Cache-Control, Pragma, Authorization, Accept, Accept-Encoding");
|
||||
header("Access-Control-Allow-Methods: PUT, POST, GET, OPTIONS, DELETE");
|
||||
require_once(realpath(dirname(__FILE__) . "/../../../bootstrap.php"));
|
||||
|
||||
use Backend\Models\GameJam;
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
require_once "../Admin/Admin.php";
|
||||
|
||||
use Backend\Models\GameJam;
|
||||
|
||||
//var_dump($_POST);
|
||||
|
@ -9,7 +10,7 @@ use Backend\Models\GameJam;
|
|||
|
||||
if (isAdmin()) {
|
||||
if (isset($_POST['newGameJam'])) {
|
||||
$gameJam = New GameJam();
|
||||
$gameJam = new GameJam();
|
||||
|
||||
$gameJam->name = $_POST["gameJamName"];
|
||||
$gameJam->start_time = $_POST["startDate"] . "T" . $_POST["startTime"];
|
||||
|
@ -21,8 +22,7 @@ if(isAdmin()){
|
|||
|
||||
if ($gameJam->save()) {
|
||||
http_response_code(201);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
http_response_code(500);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
require_once "../Admin/Admin.php";
|
||||
|
||||
use Backend\Models\GameJam;
|
||||
|
||||
if (isAdmin()) {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?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{
|
||||
} elseif (isset($_GET["gameJameId"])) {
|
||||
$registrationIds = Registration::where("game_jam_id", $_GET["gameJameId"])->pluck("game_data_id")->toArray();
|
||||
$groups = Group::whereIn("id", $registrationIds)->get();
|
||||
} else {
|
||||
$groups = Group::all();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ require_once (realpath(dirname(__FILE__) ."/../../../bootstrap.php"));
|
|||
|
||||
use Backend\Models\Group;
|
||||
use Backend\Models\Password;
|
||||
|
||||
session_start();
|
||||
|
||||
|
||||
|
@ -41,8 +42,7 @@ function passwordValidate(string $password1): bool
|
|||
|
||||
if (!$uppercase || !$lowercase || !$number || !$specialChars || (strlen($password1) >= 8 && strlen($password1) <= 255)) {
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
function makeLogin(string $groupName, int $groupId)
|
||||
|
|
|
@ -28,8 +28,7 @@ if(isset($_POST['login'])){
|
|||
//header('location: ../../../Frontend/index.php?login=success');
|
||||
//exit();
|
||||
http_response_code(200);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
session_destroy();
|
||||
http_response_code(500);
|
||||
}
|
||||
|
|
|
@ -17,18 +17,14 @@ if(isset($_POST['regGroup'])){
|
|||
if (passwordValidate($pass = $_POST['password'])) {
|
||||
$group = new Group();
|
||||
|
||||
$group->gameJam()->associate(GameJam::find($_POST['gameJamId']));
|
||||
|
||||
$group->group_name = $groupName = $_POST['groupName'];
|
||||
|
||||
$group->group_amount = $_POST['groupAmount'];
|
||||
|
||||
if (!$group->save()) {
|
||||
http_response_code(500);
|
||||
exit();
|
||||
}
|
||||
|
||||
$password = New Password();
|
||||
$password = new Password();
|
||||
|
||||
$password->group()->associate($group);
|
||||
|
||||
|
@ -39,6 +35,7 @@ if(isset($_POST['regGroup'])){
|
|||
$password->remember_token = $token;
|
||||
|
||||
if (!$password->save()) {
|
||||
$group->delete();
|
||||
http_response_code(500);
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -8,15 +8,12 @@ if(isLogin()){
|
|||
if (isset($_POST['updateGroup'])) {
|
||||
if ($group = groupViaToken($_SESSION['token'])) {
|
||||
$group->group_name = $_POST['groupName'];
|
||||
$group->group_amount = $_POST['groupAmount'];
|
||||
$group->game_jam_id = $_POST['gameJamId'];
|
||||
if (!$group->save()) {
|
||||
http_response_code(500);
|
||||
} else {
|
||||
http_response_code(201);
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "group not found"]);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
require_once "Group.php";
|
||||
|
||||
use Backend\Models\Password;
|
||||
|
||||
if (isLogin()) {
|
||||
|
@ -13,8 +14,7 @@ if(isLogin()){
|
|||
} else {
|
||||
http_response_code(201);
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "password not valid"]);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Backend\Models\Group;
|
||||
use Backend\Models\GameData;
|
||||
use Backend\Models\Vote;
|
||||
|
||||
require_once "../../../bootstrap.php";
|
||||
require_once "Vote.php";
|
||||
|
||||
|
||||
if (isset($_POST['1Vote'])) {
|
||||
if(VoteCheck($_POST['groupId'])){
|
||||
if (VoteCheck($_POST['gameDataId'])) {
|
||||
$vote = new Vote();
|
||||
$vote->group()->associate(Group::find($_POST['groupId']));
|
||||
$vote->gameDate()->associate(GameData::find($_POST['gameDataId']));
|
||||
|
||||
$vote->points += 1;
|
||||
if (!empty($_POST['comment'])) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use Backend\Models\Group;
|
||||
use Backend\Models\Vote;
|
||||
|
||||
require_once "../../../bootstrap.php";
|
||||
|
||||
|
||||
|
@ -36,5 +37,4 @@ if(isset($_POST['321Vote'])){
|
|||
exit();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Backend\Models\Vote;
|
||||
|
||||
require_once "../../../bootstrap.php";
|
||||
require_once "../Group/Group.php";
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
require_once "../Admin/Admin.php";
|
||||
|
||||
use Backend\Models\Group;
|
||||
use Backend\Models\Vote;
|
||||
use \Illuminate\Support\Collection;
|
||||
|
@ -27,8 +28,7 @@ if(isAdmin()){
|
|||
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
|
||||
header('Content-Type: application/json;charset=UTF-8');
|
||||
echo json_encode(array('data' => $winningGroups->jsonSerialize()));
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "game jam not found"]);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
|
||||
use \Backend\Models\Group;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -2,17 +2,16 @@
|
|||
require_once "../../../bootstrap.php";
|
||||
require_once "../Admin/Admin.php";
|
||||
|
||||
use Backend\Models\Group;
|
||||
use \Backend\Models\KeyWord;
|
||||
use \Backend\Models\GameJam;
|
||||
use \Illuminate\Support\Collection;
|
||||
use Backend\Models\Registration;
|
||||
|
||||
if (!isAdmin()) {
|
||||
if (isset($_GET['genKeyWord'])) {
|
||||
$gameJamId = $_GET['gameJamId'];
|
||||
$game_jam = GameJam::find($gameJamId);
|
||||
$all_group_in_game_jam_id = Group::where("game_jam_id", $game_jam->id)->pluck("id")->toArray();
|
||||
$find_all_keywords = KeyWord::whereIn("group_id", $all_group_in_game_jam_id)->inRandomOrder()->take(6)->get();
|
||||
$all_registration_in_game_jam_id = Registration::where("game_jam_id", $game_jam->id)->pluck("id")->toArray();
|
||||
$find_all_keywords = KeyWord::whereIn("group_id", $all_registration_in_game_jam_id)->inRandomOrder()->take(6)->get();
|
||||
$game_jam->key_word = $find_all_keywords->first()->key_word;
|
||||
if (!$game_jam->save()) {
|
||||
http_response_code(500);
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
require_once "../Group/Group.php";
|
||||
|
||||
use Backend\Models\GameJam;
|
||||
use Backend\Models\Registration;
|
||||
use Backend\Models\Group;
|
||||
use Backend\Models\KeyWord;
|
||||
|
||||
|
@ -8,11 +11,23 @@ session_start();
|
|||
|
||||
if (isLogin()) {
|
||||
if (isset($_POST['submitKeyWord'])) {
|
||||
//Find the group id
|
||||
//Find the group
|
||||
$group = groupViaToken($_SESSION['token']);
|
||||
|
||||
if($gameJam = GameJam::find($_POST["gameJamId"]) === null){
|
||||
http_response_code(400);
|
||||
echo json_encode(["message" => "gameJam not found"]);
|
||||
exit();
|
||||
}
|
||||
$registration = Registration::where('game_jam_id', $gameJam->id)->where("group_id", $group->id)->frist();
|
||||
if ($registration === null) {
|
||||
http_response_code(401);
|
||||
echo json_encode(["message" => "group not registered for that game jam"]);
|
||||
exit();
|
||||
}
|
||||
|
||||
//if statement to find out if the group have use all their keyWords
|
||||
if(KeyWord::where('group_id', $group->id)->count()<$group->group_amount){
|
||||
if (KeyWord::where('registration_id', $registration->id)->count() < $registration->group_amount) {
|
||||
|
||||
//Make a new keyword[Only to be used if you need to make a new of something]
|
||||
$keyword = new KeyWord();
|
||||
|
@ -21,7 +36,7 @@ if (isLogin()) {
|
|||
$keyword->key_word = $_POST['key_word'];
|
||||
|
||||
//Make foreign key from the groups table to the keyWords table
|
||||
$keyword->group()->associate($group);
|
||||
$keyword->registration()->associate($registration);
|
||||
|
||||
//Try to save it
|
||||
if (!$keyword->save()) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once realpath(dirname(__FILE__) . "/../../bootstrap.php");
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
//require bootstrap aka our database connection
|
||||
require_once realpath(dirname(__FILE__) . "/../../bootstrap.php");
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
//require bootstrap aka our database connection
|
||||
require_once realpath(dirname(__FILE__) . "/../../bootstrap.php");
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
//require bootstrap aka our database connection
|
||||
require_once realpath(dirname(__FILE__) . "/../../bootstrap.php");
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
@ -9,9 +10,6 @@ use Illuminate\Support\Facades\Schema;
|
|||
Capsule::schema()->create("groups", function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("group_name");
|
||||
$table->integer("group_amount");
|
||||
$table->foreignId("game_jam_id")->constrained("game_jams");
|
||||
$table->foreignId("game_data_id")->nullable()->constrained("game_data");
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
//require bootstrap aka our database connection
|
||||
require_once realpath(dirname(__FILE__) . "/../../bootstrap.php");
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
@ -9,7 +10,7 @@ use Illuminate\Support\Facades\Schema;
|
|||
Capsule::schema()->create("key_words", function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key_word');
|
||||
$table->foreignId("group_id")->constrained("groups");
|
||||
$table->foreignId("registrations_id")->constrained("registrations");
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
//require bootstrap aka our database connection
|
||||
require_once realpath(dirname(__FILE__) . "/../../bootstrap.php");
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
//require bootstrap aka our database connection
|
||||
require_once realpath(dirname(__FILE__) . "/../../bootstrap.php");
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
Capsule::schema()->create("registrations", function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId("group_id")->constrained("groups");
|
||||
$table->integer("group_amount");
|
||||
$table->foreignId("game_jam_id")->constrained("game_jams");
|
||||
$table->foreignId("game_data_id")->unique()->nullable()->constrained("game_data");
|
||||
$table->timestamps();
|
||||
});
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
require_once realpath(dirname(__FILE__) . "/../../bootstrap.php");
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
@ -7,8 +8,8 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
Capsule::schema()->create("votes", function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId("group_id")->constrained("groups");
|
||||
$table->tinyInteger("points");
|
||||
$table->text("comment")->nullable();
|
||||
$table->foreignId("game_data_id")->constrained("game_data");
|
||||
$table->timestamps();
|
||||
});
|
|
@ -17,6 +17,7 @@ require "GameJam.php"; //GameJam has no foreign key
|
|||
require "GameData.php"; //GameData has no foreign key
|
||||
require "Group.php"; //Group has foreign keys to the GameJam, GameData and Password tables hence we create it as one of the last tables in the database
|
||||
require "Password.php"; //Password has no foreign key
|
||||
require "Registration.php";
|
||||
require "KeyWord.php"; //Group has foreign keys to the Group
|
||||
require "Vote.php";
|
||||
require "AdminUser.php";
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Backend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class AdminUser extends Eloquent
|
||||
{
|
||||
protected $fillable = [
|
||||
|
@ -9,5 +11,4 @@ class AdminUser extends Eloquent
|
|||
];
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,14 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Backend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class GameData extends Eloquent
|
||||
{
|
||||
protected $fillable = [
|
||||
'game_name', 'game_link', 'is_web_Based', 'description', "img"
|
||||
];
|
||||
|
||||
public function group(){
|
||||
return $this->hasOne(Group::class);
|
||||
public function registration()
|
||||
{
|
||||
return $this->hasOne(Registration::class);
|
||||
}
|
||||
|
||||
public function votes()
|
||||
{
|
||||
return $this->hasMany(Vote::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Backend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
class GameJam extends Eloquent{
|
||||
|
||||
class GameJam extends Eloquent
|
||||
{
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
|
@ -13,11 +16,10 @@ class GameJam extends Eloquent{
|
|||
];
|
||||
|
||||
|
||||
public function group(){
|
||||
return $this->hasMany(Group::class);
|
||||
}
|
||||
public function hasVoted(){
|
||||
return $this->hasMany(hasVoted::class);
|
||||
public function registrations()
|
||||
{
|
||||
return $this->hasMany(Registration::class);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,26 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Backend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class Group extends Eloquent
|
||||
{
|
||||
protected $fillable = [
|
||||
'group_name', 'group_amount', 'votes'
|
||||
];
|
||||
|
||||
public function gameJam(){
|
||||
return $this->belongsTo(GameJam::class);
|
||||
}
|
||||
public function keyWord(){
|
||||
return $this->hasMany(KeyWord::class);
|
||||
}
|
||||
public function gameData(){
|
||||
return $this->belongsTo(GameData::class);
|
||||
}
|
||||
public function password(){
|
||||
|
||||
public function password()
|
||||
{
|
||||
return $this->hasOne(Password::class);
|
||||
}
|
||||
public function vote(){
|
||||
return $this->hasMany(Vote::class);
|
||||
|
||||
public function registrations()
|
||||
{
|
||||
return $this->hasMany(Registration::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Backend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
class KeyWord extends Eloquent{
|
||||
|
||||
class KeyWord extends Eloquent
|
||||
{
|
||||
protected $fillable = [
|
||||
'key_word'
|
||||
];
|
||||
|
||||
|
||||
public function group(){
|
||||
return $this->belongsTo(Group::class);
|
||||
public function registration()
|
||||
{
|
||||
return $this->belongsTo(Registration::class);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Backend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
class Password extends Eloquent{
|
||||
|
||||
class Password extends Eloquent
|
||||
{
|
||||
protected $fillable = [
|
||||
'password', 'remember_token'
|
||||
];
|
||||
|
||||
|
||||
public function group(){
|
||||
public function group()
|
||||
{
|
||||
return $this->belongsTo(Group::class);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Backend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class Registration extends Eloquent
|
||||
{
|
||||
protected $fillable = [
|
||||
'group_amount'
|
||||
];
|
||||
|
||||
|
||||
public function group()
|
||||
{
|
||||
return $this->belongsTo(Group::class);
|
||||
}
|
||||
|
||||
public function gameJam()
|
||||
{
|
||||
return $this->belongsTo(GameJam::class);
|
||||
}
|
||||
|
||||
public function keyWords()
|
||||
{
|
||||
return $this->hasMany(KeyWord::class);
|
||||
}
|
||||
|
||||
public function gameData()
|
||||
{
|
||||
return $this->belongsTo(GameData::class);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -11,9 +11,9 @@ class Vote extends Eloquent
|
|||
];
|
||||
|
||||
|
||||
public function group()
|
||||
public function gameDate()
|
||||
{
|
||||
return $this->belongsTo(Group::class);
|
||||
return $this->belongsTo(GameData::class);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue