v0.0.3 Made the delete function.
This commit is contained in:
parent
1bbefdfe08
commit
23a81e1925
|
@ -1 +1,17 @@
|
|||
<?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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,5 +15,7 @@
|
|||
<input type="text" name="description">
|
||||
<input type="submit" name="createPost" placeholder="Opret">
|
||||
</form>
|
||||
<hr>
|
||||
<a href="../Backend/controller/deletePost.php?id=1" class="del_btn">Delete</a>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue