FuelPHP Bin
Sign in
Url:
Fork
<?php class Controller_Api_User extends Controller_Rest { public function get_list() { $users = Model_User::find('all', array('select' => array('id', 'username', 'email'), 'where' => array(array('group_id', 3)))); return $this->response($users); } public function get_register() { $val = Validation::forge('register'); $val->add_field('username', 'Benutzername', 'required'); $val->add_field('email', 'E-Mail', 'required'); \Debug::dump($val, 'validation'); #die; if ($val->run()) { // Call Auth to create user $created = Auth::create_user( Input::get('username'), // Username Input::get('password'), // Password Input::get('email'), // E-Mail 3 // Group 3 = User ); if ($created) { return Response::forge('Registrierung erfolgreich', 200); } else { return Response::forge('Registrierung NICHT erfolgreich', 406); } } else { \Debug::dump($val->input(), 'input'); #die; \Debug::dump($val->validated(), 'validated'); #die; \Debug::dump($val->error(), 'error'); #die; return Response::forge('Fehler aufgetreten', 406); } } }