Commit 3412fb9f13d4acccff86c0c3ef6c3f3807db4774

Authored by Alex Savenko
1 parent c323aa3b

registration

Showing 1 changed file with 13 additions and 32 deletions   Show diff stats
app/library/App/Controllers/UserController.php
@@ -59,33 +59,14 @@ class UserController extends CrudResourceController @@ -59,33 +59,14 @@ class UserController extends CrudResourceController
59 59
60 $item = $this->createModelInstance(); 60 $item = $this->createModelInstance();
61 61
62 - /** ****************************/  
63 - $user = new User();  
64 - $user->password = 'test332332212';  
65 - $user->save();  
66 - die(var_dump($user));  
67 -  
68 - echo $user->id;  
69 -  
70 - $project = new Project();  
71 - $project->name = 'test33233222';  
72 - $project->save();  
73 - echo $project->id;  
74 -  
75 - die();  
76 -  
77 - /** **********************/  
78 -  
79 -  
80 $newItem = $this->createItem($item, $data); 62 $newItem = $this->createItem($item, $data);
81 63
82 if (!$newItem) { 64 if (!$newItem) {
83 return $this->onCreateFailed($item, $data); 65 return $this->onCreateFailed($item, $data);
84 } 66 }
85 67
86 -  
87 - //$last_id = $newItem->getWriteConnection()->lastInsertId();  
88 - //$responseData = $this->getFindData($last_id); 68 + $last_id = $newItem->getWriteConnection()->lastInsertId();
  69 + $responseData = $this->getFindData($last_id);
89 70
90 $response = $this->getCreateResponse($responseData, $data); 71 $response = $this->getCreateResponse($responseData, $data);
91 72
@@ -97,20 +78,20 @@ class UserController extends CrudResourceController @@ -97,20 +78,20 @@ class UserController extends CrudResourceController
97 78
98 } 79 }
99 80
100 -// public function whitelist()  
101 -// {  
102 -// return [  
103 -// 'username',  
104 -// 'password',  
105 -// 'email'  
106 -// ];  
107 -// }  
108 -  
109 - protected function getModelPrimaryKey() 81 + public function whitelist()
110 { 82 {
111 - return 'id'; 83 + return [
  84 + 'username',
  85 + 'password',
  86 + 'email'
  87 + ];
112 } 88 }
113 89
  90 +// protected function getModelPrimaryKey()
  91 +// {
  92 +// return 'id';
  93 +// }
  94 +
114 protected function transformPostDataValue($key, $value, $data) 95 protected function transformPostDataValue($key, $value, $data)
115 { 96 {
116 if ($key == 'password') { 97 if ($key == 'password') {