itskp-odense/Backend/controller/deletePost.php

18 lines
320 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($_GET['delete_id'])){
$id = $_GET['delete_id'];
2021-06-02 07:23:08 +00:00
$findId = Post::query()->findOrFail($id);
if(!$findId->delete()){
return "Error could not delete";
2021-06-02 07:23:08 +00:00
}else{
return "Record deleted";
2021-06-02 07:23:08 +00:00
}
}