v0.1.0 - Updated Deletetion of post
Updated home to admin Updated create & fetch Added DataTables Added Icons for DataTables Added SWAL
This commit is contained in:
@@ -9,9 +9,9 @@ if(isset($_POST['delete_id'])){
|
||||
$id = $_POST['delete_id'];
|
||||
$findId = Post::query()->findOrFail($id);
|
||||
if(!$findId->delete()){
|
||||
return "Error could not delete";
|
||||
return 0;
|
||||
}else{
|
||||
return "Record deleted";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ if (isset($_POST['loginsubmit'])) {
|
||||
if ($password->save()) {
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['name'] = $username;
|
||||
header('location: ../../Frontend/home.php?login=success');
|
||||
header('location: ../../Frontend/admin.php?login=success');
|
||||
exit();
|
||||
http_response_code(200);
|
||||
} else {
|
||||
|
||||
@@ -12,6 +12,6 @@ if(isset($_POST['update'])){
|
||||
if(!$post->update()){
|
||||
echo "Error could not update";
|
||||
}else{
|
||||
header("location: ../../Frontend/home.php");
|
||||
header("location: ../../Frontend/admin.php");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user