From e1e879e94b58e75682d593932e0ce6650f5151c4 Mon Sep 17 00:00:00 2001 From: neerholt Date: Fri, 5 Mar 2021 10:52:42 +0100 Subject: [PATCH] Fixed key word error --- Backend/Login.php | 2 +- Backend/Models/{keyWord.php => KeyWord.php} | 2 +- Backend/keyWordsRemaining.php | 18 ++++++++++++++++ Frontend/group.php | 24 +++++++++++++++++++++ Frontend/index.html | 10 --------- 5 files changed, 44 insertions(+), 12 deletions(-) rename Backend/Models/{keyWord.php => KeyWord.php} (81%) create mode 100644 Backend/keyWordsRemaining.php create mode 100644 Frontend/group.php delete mode 100644 Frontend/index.html diff --git a/Backend/Login.php b/Backend/Login.php index ff3c468..3064c03 100644 --- a/Backend/Login.php +++ b/Backend/Login.php @@ -19,7 +19,7 @@ if(isset($_POST['login'])){ if(password_verify($password, $hashedPassword )){ $_SESSION['groupName'] = $groupName; $_SESSION['success'] = "You are now logged in"; - header('location: Main.php?login=success'); + header('location: ../Frontend/group.php?login=success'); } } diff --git a/Backend/Models/keyWord.php b/Backend/Models/KeyWord.php similarity index 81% rename from Backend/Models/keyWord.php rename to Backend/Models/KeyWord.php index 7ee3f83..cd40593 100644 --- a/Backend/Models/keyWord.php +++ b/Backend/Models/KeyWord.php @@ -8,7 +8,7 @@ class KeyWord extends Eloquent{ public function group(){ - return $this->hasOne(Group::class); + return $this->belongsTo(Group::class); } } \ No newline at end of file diff --git a/Backend/keyWordsRemaining.php b/Backend/keyWordsRemaining.php new file mode 100644 index 0000000..e6be58c --- /dev/null +++ b/Backend/keyWordsRemaining.php @@ -0,0 +1,18 @@ +keyWord = $_POST['key_word']; + + $keyword->group()->associate(Group::find($_POST['group_id'])); + + if(!$keyword->save()){ + return; + } + +} \ No newline at end of file diff --git a/Frontend/group.php b/Frontend/group.php new file mode 100644 index 0000000..2e19180 --- /dev/null +++ b/Frontend/group.php @@ -0,0 +1,24 @@ + + + + + + + Title + + + + +
+ + + +
+ + + + \ No newline at end of file diff --git a/Frontend/index.html b/Frontend/index.html deleted file mode 100644 index 566549b..0000000 --- a/Frontend/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Title - - - - - \ No newline at end of file