itskp-odense/Backend/controller/deletePost.php

18 lines
284 B
PHP
Raw Normal View History

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