itskp-odense/Backend/controller/deletePost.php

18 lines
284 B
PHP

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