From 23a81e1925edfa5765fa9b551fae4a618d4b4a95 Mon Sep 17 00:00:00 2001 From: Victor Date: Wed, 2 Jun 2021 09:23:08 +0200 Subject: [PATCH] v0.0.3 Made the delete function. --- Backend/controller/deletePost.php | 16 ++++++++++++++++ Backend/controller/upload.php | 2 +- Frontend/home.php | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Backend/controller/deletePost.php b/Backend/controller/deletePost.php index b3d9bbc..8b9cd2d 100644 --- a/Backend/controller/deletePost.php +++ b/Backend/controller/deletePost.php @@ -1 +1,17 @@ findOrFail($id); + + if(!$findId->delete()){ + echo "Error could not delete record"; + }else{ + header("location: ../../Frontend/home.php?recordDeleted"); + } +} + diff --git a/Backend/controller/upload.php b/Backend/controller/upload.php index 3e9139c..9622b2e 100644 --- a/Backend/controller/upload.php +++ b/Backend/controller/upload.php @@ -22,6 +22,6 @@ if(isset($_POST['createPost'])){ echo "Failed to save the post"; exit(); }else{ - echo "Post has been saved"; + header("location: ../../Frontend/home.php?Post=UploadSuccess"); } } diff --git a/Frontend/home.php b/Frontend/home.php index 0d3590a..580556c 100644 --- a/Frontend/home.php +++ b/Frontend/home.php @@ -15,5 +15,7 @@ +
+ Delete