diff --git a/app/library/App/Controllers/UserController.php b/app/library/App/Controllers/UserController.php index aff9caf..135873b 100755 --- a/app/library/App/Controllers/UserController.php +++ b/app/library/App/Controllers/UserController.php @@ -59,33 +59,14 @@ class UserController extends CrudResourceController $item = $this->createModelInstance(); - /** ****************************/ - $user = new User(); - $user->password = 'test332332212'; - $user->save(); - die(var_dump($user)); - - echo $user->id; - - $project = new Project(); - $project->name = 'test33233222'; - $project->save(); - echo $project->id; - - die(); - - /** **********************/ - - $newItem = $this->createItem($item, $data); if (!$newItem) { return $this->onCreateFailed($item, $data); } - - //$last_id = $newItem->getWriteConnection()->lastInsertId(); - //$responseData = $this->getFindData($last_id); + $last_id = $newItem->getWriteConnection()->lastInsertId(); + $responseData = $this->getFindData($last_id); $response = $this->getCreateResponse($responseData, $data); @@ -97,20 +78,20 @@ class UserController extends CrudResourceController } -// public function whitelist() -// { -// return [ -// 'username', -// 'password', -// 'email' -// ]; -// } - - protected function getModelPrimaryKey() + public function whitelist() { - return 'id'; + return [ + 'username', + 'password', + 'email' + ]; } +// protected function getModelPrimaryKey() +// { +// return 'id'; +// } + protected function transformPostDataValue($key, $value, $data) { if ($key == 'password') { -- libgit2 0.21.4