当前位置: 首页>>代码示例>>PHP>>正文


PHP Users::create方法代码示例

本文整理汇总了PHP中app\models\Users::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::create方法的具体用法?PHP Users::create怎么用?PHP Users::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Users的用法示例。


在下文中一共展示了Users::create方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getx

 public function getx()
 {
     $uuid = new Uuid();
     // Usage
     // Named-based UUID.
     $email = $this->request->query['email'];
     $phone = $this->request->query['phoneNumber'];
     $code = $this->request->query['code'];
     $walletid = $this->request->query['walletid'];
     $password = $this->request->query['password'];
     $ip = $this->request->query['ip'];
     $kyc = $this->request->query['kyc_id'];
     if ($email != null && $phone != null && $code != null && $walletid != null) {
         $xemail = $uuid->hashme($email);
         $xphone = $uuid->hashme($phone);
         $xcode = $uuid->hashme($code);
         $xwalletid = $uuid->hashme($walletid);
         $ga = new GoogleAuthenticator();
         $secret = $ga->createSecret(64);
         $data = array('walletid' => $walletid, 'kyc' => $kyc, 'secret' => $secret, 'password.send.email' => false);
         $Details = Details::create($data);
         $saved = $Details->save();
         $data = array('walletid' => $walletid, 'password' => password_hash($password, PASSWORD_BCRYPT), 'ip' => $ip, 'email' => $email, 'xemail' => $xemail, 'phone' => $phone, 'xphone' => $xphone, 'code' => $code, 'xcode' => $xcode);
         $Users = Users::create($data);
         $saved = $Users->save();
         if ($saved == true) {
             $id = $Users->_id;
         }
         return $this->render(array('json' => array('success' => 1, 'record' => 0, 'email' => $email, 'phone' => $phone, 'code' => $code, 'walletid' => $walletid, 'password' => $password, 'xemail' => $xemail, 'xphone' => $xphone, 'xcode' => $xcode, 'xwalletid' => $xwalletid, 'id' => (string) $id, 'ip' => $ip)));
     } else {
         return $this->render(array('json' => array('success' => 0)));
     }
 }
开发者ID:nilamdoc,项目名称:XGCWallet.org,代码行数:33,代码来源:ExController.php

示例2: add

 public function add()
 {
     $login = Auth::check('member');
     if ($login['rol'] != 'administrator') {
         return $this->redirect('/');
     }
     unset($this->request->data['repeat_password']);
     unset($this->request->data['user_ok']);
     unset($this->request->data['password_ok']);
     $user = Users::create($this->request->data);
     if ($this->request->data && $user->save()) {
         $users = Users::all();
         return compact('users');
     }
     $locations = Locations::find('all', array('order' => array('district' => 'ASC')));
     foreach ($locations as $key => $location) {
         $provincie = $locations[$key]['provincie'];
         $district = $locations[$key]['district'];
         if ($login['rol'] != 'administrator') {
             if ($provincie == $login['location']) {
                 $locaties[$district] = $district . ' (' . $locations[$key]['provincie'] . ')';
             }
         } else {
             $locaties[$district] = $district . ' (' . $locations[$key]['provincie'] . ')';
         }
     }
     $actief = self::$actief;
     $breadcrumb = self::$breadcrumb;
     $breadcrumb[] = array('naam' => 'Gebruiker toevoegen');
     return compact('user', 'login', 'actief', 'breadcrumb', 'locaties');
 }
开发者ID:beeckmpi,项目名称:permanentielijsten,代码行数:31,代码来源:UsersController.php

示例3: add

 public function add()
 {
     $user = Users::create();
     if ($this->request->data && $user->save($this->request->data)) {
         return $this->redirect(array('Users::index'));
     }
     return compact('user');
 }
开发者ID:nilamdoc,项目名称:li3_example,代码行数:8,代码来源:UsersController.php

示例4: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $fileImage = $data['avatar_image'];
     $nameFileImage = $fileImage->getClientOriginalName();
     $public_patch = public_path();
     $url = $public_patch . '/assets/imgs/profiles';
     $fileImage->move($url, $nameFileImage);
     return Users::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'username' => $data['username'], 'avatar_image' => '/assets/imgs/profiles/' . $nameFileImage]);
 }
开发者ID:jcaicedo,项目名称:sisgenoaca,代码行数:15,代码来源:AuthController.php

示例5: store

 public function store($request)
 {
     $cacheTag = ['users'];
     $validator = $this->validate($request);
     if (!$validator->fails()) {
         Logs::create(['activity' => 'store', 'module' => 'users']);
         Cache::tags($cacheTag)->flush();
         $request['active'] = true;
         //Always Actived on Store
         $request['password'] = Hash::make($request['password']);
         //Encrypt Password
         $request['company_id'] = config('global.companies.current.id');
         return Users::create($request);
     } else {
         return new \Exception($validator->errors()->first());
     }
 }
开发者ID:PingadoWeb,项目名称:deliveryApi,代码行数:17,代码来源:UsersRepository.php

示例6: postUser

 public function postUser()
 {
     $Company = Input::only("Title", "Address1", "Address2", "ZipCode", "City", "Phone", "Email", "CountryID");
     $Inputs = Input::only("Username", "Password");
     $Validator = Validator::make($Inputs, ["Username" => "required", "Password" => "required"]);
     $hasConnection = Storage::disk('local')->exists('instapack-connections.json');
     $hasEmailSettings = Storage::disk('local')->exists('instapack-emails.json');
     if ($Validator->fails() || $hasConnection == FALSE || $hasEmailSettings == FALSE) {
         return redirect()->route("instapack::user")->withInput()->withErrors($Validator)->with("Errormessage", "test");
     }
     $Company["isOwn"] = 1;
     $Inputs["Password"] = Hash::make($Inputs["Password"]);
     $Data = array("Status" => "Installed", "ResultCode" => str_random(40));
     $Connection = json_decode(Storage::disk('local')->get('instapack-connections.json'));
     $Emails = json_decode(Storage::disk('local')->get('instapack-emails.json'));
     $deg = new DotEnvGen();
     $deg->parseExample();
     $deg->setField("APP_ENV", "production");
     $deg->setField("APP_DEBUG", "false");
     $deg->setField("APP_KEY", $Data["ResultCode"]);
     $deg->setField("APP_URL", Request::root());
     $deg->setField("DB_HOST", $Connection->Hostname);
     $deg->setField("DB_PORT", "3306");
     $deg->setField("DB_DATABASE", $Connection->Database);
     $deg->setField("DB_USERNAME", $Connection->Username);
     $deg->setField("DB_PASSWORD", $Connection->Password);
     $deg->setField("MAIL_DRIVER", "smtp");
     $deg->setField("MAIL_HOST", $Emails->Hostname);
     $deg->setField("MAIL_PORT", "587");
     $deg->setField("MAIL_USERNAME", $Emails->Hostname);
     $deg->setField("MAIL_PASSWORD", $Emails->Hostname);
     $deg->setField("MAIL_ENCRYPTION", "null");
     $deg->createEnv(base_path() . "/.env");
     /* Migration and Seeds */
     Artisan::call('migrate');
     Artisan::call('db:seed');
     Users::create($Inputs);
     Companies::create($Company);
     Storage::disk('local')->delete(['instapack-connections.json', 'instapack-emails.json']);
     Storage::disk('local')->put('instapack.json', $Data);
     return redirect("/");
 }
开发者ID:kaankilic,项目名称:instapack,代码行数:42,代码来源:UsersController.php

示例7: addAction

 public function addAction()
 {
     $success = false;
     $errors = array();
     if (!Auth::check('default')) {
         $errors['login'] = 'You need to be logged.';
     } else {
         if (!$this->request->is('post')) {
             $errors['call'] = 'This action can only be called with post';
         } else {
             if ($this->request->data) {
                 $user = Users::create($this->request->data);
                 if (!($success = $user->save())) {
                     $errors = $user->errors();
                 }
             }
         }
     }
     return compact('success', 'errors');
 }
开发者ID:romainwurtz,项目名称:Li3Press,代码行数:20,代码来源:UsersController.php

示例8: create

 public function create()
 {
     if (isset($this->CURRENT_USER)) {
         $this->flashMessage('You don\'t need to register, you\'re already logged in!', array('alertType' => 'warning'));
         return $this->redirect('Dashboard::user');
     }
     $user = Users::create();
     if ($this->request->data) {
         // Extract password data
         $password = $this->request->data['password'];
         $confirm_password = $this->request->data['confirm_password'];
         unset($this->request->data['password']);
         unset($this->request->data['confirm_password']);
         // Check validity of user
         $user->set($this->request->data);
         $user->validates();
         // Check validity of password:
         if (strlen($password) < 6) {
             $user->errors('password', 'Must be at least six characters long.');
         }
         if ($password != $confirm_password) {
             $user->errors('confirm_password', 'Passwords do not match.');
         }
         // Save the user and identity
         if (count($user->errors()) === 0 and $user->save(array('permission_groups' => 'user'))) {
             $identity = PasswordIdentities::create();
             $identitySaveResult = $identity->save(array('user_id' => $user->_id, 'prv_uid' => $this->request->data['email_address'], 'password' => $password));
             if (!$identitySaveResult) {
                 $this->flashMessage('Your user account was created, but there was a problem saving your password. Please use the password reset functionality to fix it.', array('alertType' => 'error'));
             } else {
                 $this->flashMessage('You have successfully registered!');
                 return $this->redirect('/');
             }
         } else {
             $this->flashMessage('There was an error creating your account.', array('alertType' => 'error'));
         }
     }
     return compact('user');
 }
开发者ID:aniston,项目名称:Platypus,代码行数:39,代码来源:UsersController.php

示例9: signup

 public function signup()
 {
     if ($this->request->data) {
         $Users = Users::create($this->request->data);
         $saved = $Users->save();
         if ($saved == true) {
             $verification = sha1($Users->_id);
             //			$bitcoin = new Bitcoin('http://'.BITCOIN_WALLET_SERVER.':'.BITCOIN_WALLET_PORT,BITCOIN_WALLET_USERNAME,BITCOIN_WALLET_PASSWORD);
             //	$coinprism = new Coinprism(COINPRISM_USERNAME,COINPRISM_PASSWORD);
             //	$response = $coinprism->create_address('NEWUSER',"NEWUSER");
             //	print_r($response);
             //			$bitcoinaddress = '';//$bitcoin->getaccountaddress($this->request->data['username']);
             //			$oauth = new OAuth2();
             //			$key_secret = $oauth->request_token();
             $ga = new GoogleAuthenticator();
             $data = array('user_id' => (string) $Users->_id, 'username' => (string) $Users->username, 'email.verify' => $verification, 'mobile.verified' => "No", 'mobile.number' => "", 'key' => $ga->createSecret(64), 'secret' => $ga->createSecret(64), 'Friend' => array(), 'EmailPasswordSecurity' => true, 'balance.BTC' => (double) 0, 'balance.XGC' => (double) 0, 'balance.USD' => (double) 0, 'balance.EUR' => (double) 0, 'balance.CAD' => (double) 0);
             Details::create()->save($data);
             $email = $this->request->data['email'];
             $name = $this->request->data['firstname'];
             $view = new View(array('loader' => 'File', 'renderer' => 'File', 'paths' => array('template' => '{:library}/views/{:controller}/{:template}.{:type}.php')));
             $body = $view->render('template', compact('email', 'verification', 'name'), array('controller' => 'users', 'template' => 'confirm', 'type' => 'mail', 'layout' => false));
             $transport = Swift_MailTransport::newInstance();
             $mailer = Swift_Mailer::newInstance($transport);
             $message = Swift_Message::newInstance();
             $message->setSubject("Verification of email from " . COMPANY_URL);
             $message->setFrom(array(NOREPLY => 'Verification email ' . COMPANY_URL));
             $message->setTo($Users->email);
             $message->addBcc(MAIL_1);
             $message->addBcc(MAIL_2);
             $message->addBcc(MAIL_3);
             $message->setBody($body, 'text/html');
             $mailer->send($message);
             $this->redirect('Users::email');
         }
     }
     return compact('saved', 'Users');
 }
开发者ID:nilamdoc,项目名称:msx,代码行数:37,代码来源:UsersController.php

示例10: signup

 public function signup()
 {
     if ($this->request->data) {
         //		if(stristr( $_SERVER['HTTP_REFERER'],COMPANY_URL)===FALSE){return $this->redirect('/login');exit;}
         $Users = Users::create($this->request->data);
         $saved = $Users->save();
         if ($saved == true) {
             $verification = sha1($Users->_id);
             //			$oauth = new OAuth2();
             //			$key_secret = $oauth->request_token();
             $ga = new GoogleAuthenticator();
             $data = array('user_id' => (string) $Users->_id, 'username' => (string) $Users->username, 'email.verify' => $verification, 'mobile.verified' => "No", 'mobile.number' => "", 'key' => $ga->createSecret(64), 'secret' => $ga->createSecret(64), 'Friend' => array());
             $Details = Details::create($data);
             $saved = $Details->save();
             $data = array('user_id' => (string) $Users->_id, 'email' => $Users->email, 'username' => (string) $Users->username, 'detail_id' => (string) $Details->_id, 'hash' => md5($Users->email), 'IP' => $_SERVER['REMOTE_ADDR']);
             $Documents = Documents::create($data);
             $saved = $Documents->save();
             $email = $this->request->data['email'];
             $name = $this->request->data['firstname'];
             $view = new View(array('loader' => 'File', 'renderer' => 'File', 'paths' => array('template' => '{:library}/views/{:controller}/{:template}.{:type}.php')));
             $body = $view->render('template', compact('email', 'verification', 'name'), array('controller' => 'users', 'template' => 'confirm', 'type' => 'mail', 'layout' => false));
             $transport = Swift_MailTransport::newInstance();
             $mailer = Swift_Mailer::newInstance($transport);
             $message = Swift_Message::newInstance();
             $message->setSubject("Verification of email from " . COMPANY_URL);
             $message->setFrom(array(NOREPLY => 'Verification email ' . COMPANY_URL));
             $message->setTo($Users->email);
             $message->addBcc(MAIL_1);
             $message->addBcc(MAIL_2);
             $message->addBcc(MAIL_3);
             $message->setBody($body, 'text/html');
             $mailer->send($message);
             $this->redirect('Users::email');
         }
     }
     return compact('saved', 'Users');
 }
开发者ID:nilamdoc,项目名称:OxOPDF,代码行数:37,代码来源:UsersController.php

示例11: register

 public function register()
 {
     if (!$this->request->query['UserName']) {
         return $this->render(array('json' => array("Error" => "Username not specified")));
     }
     if (!$this->request->query['FirstName']) {
         return $this->render(array('json' => array("Error" => "Firstname not specified")));
     }
     if (!$this->request->query['LastName']) {
         return $this->render(array('json' => array("Error" => "Lastname not specified")));
     }
     if (!$this->request->query['Email']) {
         return $this->render(array('json' => array("Error" => "Email not specified")));
     }
     if (!$this->request->query['Password']) {
         return $this->render(array('json' => array("Error" => "Password not specified")));
     }
     $uuid = new Uuid();
     $ga = new GoogleAuthenticator();
     $xemail = $uuid->hashme($this->request->query['Email']);
     $xwalletid = $uuid->hashme($this->request->query['Walletid']);
     $data = array('username' => $this->request->query['UserName'], 'firstname' => $this->request->query['FirstName'], 'lastname' => $this->request->query['LastName'], 'email' => $this->request->query['Email'], 'password' => password_hash($this->request->query['Password'], PASSWORD_BCRYPT), 'walletid' => $this->request->query['Walletid']);
     $Users = Users::create($data);
     $saved = $Users->save();
     if ($saved == true) {
         $verification = sha1($Users->_id);
         $data = array('user_id' => (string) $Users->_id, 'username' => (string) $Users->username, 'email.verify' => $verification, 'email.verified' => "No", 'mobile.verified' => "No", 'mobile.number' => "", 'key' => $ga->createSecret(64), 'secret' => $ga->createSecret(64), 'walletid' => $this->request->query['Walletid']);
         Details::create()->save($data);
     } else {
         return $this->render(array('json' => array("success" => 0)));
     }
     $xmain_email = $uuid->hashme(MAIN_EMAIL);
     $xescrow_email = $uuid->hashme(ESCROW_EMAIL);
     return $this->render(array('json' => array("success" => 1, "xemail" => $xemail, "xwalletid" => $xwalletid, "recordid" => (string) $Users->_id, "main_email" => MAIN_EMAIL, "escrow_email" => ESCROW_EMAIL, "xmain_email" => $xmain_email, "xescrow_email" => $xescrow_email)));
 }
开发者ID:nilamdoc,项目名称:msx,代码行数:35,代码来源:ExController.php

示例12: register

 public function register()
 {
     Users::redirectIf(true);
     $nickname = Helper::post('nickname');
     $password = Helper::post('password');
     $confirm = Helper::post('password_confirm');
     $email = Helper::post('email');
     if (empty($nickname) || empty($password) || empty($confirm) || empty($email)) {
         Session::setFlash('danger', '', Translate::get('error.forms.missing.content'));
         Router::redirect('user.signup');
     }
     $errors = [];
     if (strlen($nickname) < 3 || strlen($nickname) > 40) {
         $errors['username'] = Translate::get('register.error.username');
     }
     if (!preg_match('#[a-zA-Z0-9\\_\\.]+#', $nickname)) {
         $errors['username'] = Translate::get('register.error.username');
     }
     if (strlen($password) < 6) {
         $errors['password'] = Translate::get('register.error.password');
     }
     if ($password != $confirm) {
         $errors['password'] = Translate::get('register.error.password_confirm');
     }
     if (!preg_match('/[a-zA-Z0-9\\_\\-\\.]{3,}@[a-zA-Z0-9\\-]{2,}\\.[a-z]{2,6}/', $email)) {
         $errors['email'] = Translate::get('register.error.email');
     }
     if (!empty($errors)) {
         ob_start();
         Translate::getContent('error_fields', ['errors' => $errors]);
         $content = ob_get_clean();
         Session::setFlash('danger', '', $content);
         Router::redirect('user.signup');
     }
     $users = Users::select()->addFields(['id'])->where('nickname', $nickname)->andWhere('mail', $email)->get(0, 1);
     if (!empty($users)) {
         Session::setFlash('danger', '', Translate::get('user.error.register'));
         Router::redirect('user.signup');
     }
     $random = '';
     while ($random == '') {
         $random = Config::randomString(14);
         if (Users::find('user_key', $random)) {
             $random = '';
         }
     }
     $default_group = Groups::find('g_default', 1);
     $user = Users::create();
     $user->id_group = $default_group->id;
     // TODO: Change for default group
     $user->nickname = $nickname;
     $user->password = password_hash($password, PASSWORD_BCRYPT);
     $user->user_key = $random;
     $user->mail = $email;
     $user->mail_check = sha1($user->user_key);
     $user->mail_check_at = BaseModel::now();
     $user->register_at = BaseModel::now();
     $user->connection_at = '0000-00-00 00:00:00';
     $user->save();
     Users::sendMailCheck($user);
     Session::setFlash('success', '', Translate::get('user.success.register'));
     Router::redirect('home.index');
 }
开发者ID:quenti77,项目名称:easyhq,代码行数:63,代码来源:UserController.php

示例13: add

 /**
  * Add a new User, needed for testing
  *
  * @return array
  */
 public function add()
 {
     $user = Users::create();
     $user->save($this->request->data, array('safe' => true));
     return array('user' => $user->data());
 }
开发者ID:nervetattoo,项目名称:li3-request-signing,代码行数:11,代码来源:UsersController.php

示例14: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $user = Users::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
     $user->attachRole(Role::CLIENT_ROLE_ID);
     return $user;
 }
开发者ID:qvp,项目名称:easyads,代码行数:12,代码来源:AuthController.php


注:本文中的app\models\Users::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。