v0.1.4aa - Added create & get user backend
This commit is contained in:
parent
4b959d0444
commit
7e808b05b4
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
//require our bootstrap file for database connection
|
||||||
|
require "../../bootstrap.php";
|
||||||
|
|
||||||
|
use Backend\Model\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'];
|
||||||
|
|
||||||
|
//Call the save function.
|
||||||
|
if($post->save())
|
||||||
|
echo $post->id;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
require "../../bootstrap.php";
|
||||||
|
|
||||||
|
use Backend\Model\Post;
|
||||||
|
|
||||||
|
header('Content-Type: application/json;charset=UTF-8');
|
||||||
|
|
||||||
|
if(isset($_POST['id']))
|
||||||
|
$data = Post::find($_POST['id']);
|
||||||
|
else
|
||||||
|
$data = Post::all();
|
||||||
|
echo $data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue