From fff330705a28d63b9f79dd096cab743458642803 Mon Sep 17 00:00:00 2001 From: neerholt Date: Wed, 3 Mar 2021 12:48:49 +0100 Subject: [PATCH] Made fk key --- Backend/Main.php | 5 +++++ Backend/Models/GameData.php | 4 ++++ Backend/Models/GameJam.php | 6 ++++++ Backend/Models/Group.php | 19 ++++++++++++++++++- Backend/Models/Password.php | 6 ++++++ Backend/Models/keyWord.php | 6 ++++++ 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Backend/Main.php b/Backend/Main.php index b3d9bbc..fb8885f 100644 --- a/Backend/Main.php +++ b/Backend/Main.php @@ -1 +1,6 @@ "First game jam ever!", 'startTime' => "2021-03-03T12:40", 'endTime' => "2021-04-03T12:40", 'description' => "Det her et en beskrivelse" +]); diff --git a/Backend/Models/GameData.php b/Backend/Models/GameData.php index 9b5649c..4c550ff 100644 --- a/Backend/Models/GameData.php +++ b/Backend/Models/GameData.php @@ -5,4 +5,8 @@ class GameData extends Eloquent protected $fillable = [ 'gameLink', 'isWebBased' ]; + + public function group(){ + return $this->hasOne(Group::class); + } } diff --git a/Backend/Models/GameJam.php b/Backend/Models/GameJam.php index 183d1f0..02d26db 100644 --- a/Backend/Models/GameJam.php +++ b/Backend/Models/GameJam.php @@ -4,4 +4,10 @@ class GameJam extends Eloquent{ protected $fillable =[ 'name', 'startTime', 'endTime', 'keyWord', 'description' ]; + + + public function group(){ + return $this->hasMany(Group::class); + } + } \ No newline at end of file diff --git a/Backend/Models/Group.php b/Backend/Models/Group.php index 01ab401..abc5fd7 100644 --- a/Backend/Models/Group.php +++ b/Backend/Models/Group.php @@ -1,8 +1,25 @@ hasOne(Password::class); + } + + public function gameData(){ + return $this->hasOne(GameData::class); + } + + public function gameJam(){ + return $this->hasOne(GameJam::class); + } + + public function keyWord(){ + return $this->hasMany(KeyWord::class); + } + } diff --git a/Backend/Models/Password.php b/Backend/Models/Password.php index 3f2fa62..55d5f84 100644 --- a/Backend/Models/Password.php +++ b/Backend/Models/Password.php @@ -4,4 +4,10 @@ class Password extends Eloquent{ protected $fillable =[ 'password' ]; + + + public function group(){ + return $this->hasOne(Group::class); + } + } \ No newline at end of file diff --git a/Backend/Models/keyWord.php b/Backend/Models/keyWord.php index 111ab59..8102496 100644 --- a/Backend/Models/keyWord.php +++ b/Backend/Models/keyWord.php @@ -4,4 +4,10 @@ class KeyWord extends Eloquent{ protected $fillable =[ 'keyWord' ]; + + + public function group(){ + return $this->hasOne(Group::class); + } + } \ No newline at end of file