v0.0.10 when you are login in the login button says admin panle, and semi added ajax update post
This commit is contained in:
@@ -5,8 +5,8 @@ require "../../bootstrap.php";
|
||||
|
||||
use Backend\Model\Post;
|
||||
|
||||
if(isset($_GET['delete_id'])){
|
||||
$id = $_GET['delete_id'];
|
||||
if(isset($_POST['delete_id'])){
|
||||
$id = $_POST['delete_id'];
|
||||
$findId = Post::query()->findOrFail($id);
|
||||
if(!$findId->delete()){
|
||||
return "Error could not delete";
|
||||
|
||||
@@ -4,17 +4,18 @@ require "../../bootstrap.php";
|
||||
|
||||
use Backend\Model\Post;
|
||||
|
||||
//Create a new initialize
|
||||
$post = new Post();
|
||||
if(isset($_POST['title'])){
|
||||
//Create a new initialize
|
||||
$post = new Post();
|
||||
|
||||
//Get the data from post and save it to the post model
|
||||
$post->title = $_POST['title'];
|
||||
$post->description = $_POST['description'];
|
||||
//Get the data from post and save it to the post model
|
||||
$post->title = $_POST['title'];
|
||||
$post->description = $_POST['description'];
|
||||
|
||||
//Call the save function.
|
||||
if(!$post->save()){
|
||||
return http_response_code(400);
|
||||
}else{
|
||||
return http_response_code(200);
|
||||
//Call the save function.
|
||||
if(!$post->save()){
|
||||
return http_response_code(400);
|
||||
}else{
|
||||
return http_response_code(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user