itskp-odense/Backend/controller/deletePost.php

18 lines
319 B
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");
}
}