Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anders 2021-06-02 13:27:35 +02:00
commit d3e832405c
3 changed files with 19 additions and 1 deletions

View File

@ -1 +1,17 @@
<?php <?php
require "../../bootstrap.php";
use Backend\Model\Post;
if(isset($_GET['id'])){
$id = $_GET['id'];
$findId = Post::query()->findOrFail($id);
if(!$findId->delete()){
echo "Error could not delete record";
}else{
header("location: ../../Frontend/home.php?recordDeleted");
}
}

View File

@ -22,6 +22,6 @@ if(isset($_POST['createPost'])){
echo "Failed to save the post"; echo "Failed to save the post";
exit(); exit();
}else{ }else{
echo "Post has been saved"; header("location: ../../Frontend/home.php?Post=UploadSuccess");
} }
} }

View File

@ -15,5 +15,7 @@
<input type="text" name="description"> <input type="text" name="description">
<input type="submit" name="createPost" placeholder="Opret"> <input type="submit" name="createPost" placeholder="Opret">
</form> </form>
<hr>
<a href="../Backend/controller/deletePost.php?id=1" class="del_btn">Delete</a>
</body> </body>
</html> </html>