v0.1.5b Added the rest of the create user account function, update and getUserdata
This commit is contained in:
parent
b0fd4d4320
commit
c35c4524db
|
@ -1,14 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
require "../../bootstrap.php";
|
require "../../bootstrap.php";
|
||||||
|
|
||||||
use Backend\Model\Post;
|
use Backend\Model\User;
|
||||||
|
|
||||||
header('Content-Type: application/json;charset=UTF-8');
|
header('Content-Type: application/json;charset=UTF-8');
|
||||||
|
|
||||||
if(isset($_POST['id']))
|
if(isset($_POST['id']))
|
||||||
$data = Post::find($_POST['id']);
|
$data = User::find($_POST['id']);
|
||||||
else
|
else
|
||||||
$data = Post::all();
|
$data = User::all('id', 'name');
|
||||||
echo $data;
|
echo $data;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,15 @@
|
||||||
|
|
||||||
require "../../bootstrap.php";
|
require "../../bootstrap.php";
|
||||||
|
|
||||||
use Backend\Model\Post;
|
use Backend\Model\User;
|
||||||
|
|
||||||
if(isset($_POST['id'])){
|
if(isset($_POST['id'])){
|
||||||
$post = Post::query()->find($_POST['id']);
|
$user = User::query()->find($_POST['id']);
|
||||||
$post->title = $_POST['upTitle'];
|
$user->name = $_POST['upName'];
|
||||||
$post->description = $_POST['upDescription'];
|
$newPass = password_hash($_POST['upPassword'], PASSWORD_DEFAULT);
|
||||||
|
$user->password = $newPass;
|
||||||
|
|
||||||
if($post->update()){
|
if($user->update()){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue