itskp-odense/Backend/controller/deletePost.php

18 lines
320 B
PHP

<?php
require "accessControl.php";
require "../../bootstrap.php";
use Backend\Model\Post;
if(isset($_GET['delete_id'])){
$id = $_GET['delete_id'];
$findId = Post::query()->findOrFail($id);
if(!$findId->delete()){
return "Error could not delete";
}else{
return "Record deleted";
}
}