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


PHP UserInfo::save方法代码示例

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


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

示例1: store

 public function store()
 {
     $rules = array('email' => 'unique:users|required|email');
     $validate = Validator::make(Input::all(), $rules);
     if ($validate->fails()) {
         $msg = 'Пользователь с этим емайлом уже существует на нашей платформе.';
         return Redirect::to('/')->withErrors($validate)->withInput()->with('msg', $msg);
     } else {
         $user = new User();
         $userInfo = new UserInfo();
         $userMoney = new UserMoney();
         $userInfo->lat = 0;
         $userInfo->long = 0;
         $userInfo->save();
         $userMoney->save();
         $user->user_info_id = $userInfo->id;
         $user->user_money_id = $userMoney->id;
         $user->email = Input::get('email');
         $user->role = 2;
         $user->awaiting_award = 0;
         $user->investor = 0;
         $user->registration_code = str_random(64);
         $password = str_random(12);
         $user->password = Hash::make($password);
         $user->registration_status = 0;
         $user->save();
         $data = ['code' => $user->registration_code, 'password' => $password];
         Mail::send('emails.confirmation', $data, function ($message) {
             $message->to(Input::get('email'), 'test')->subject('Спасибо за регистрацию на нашей платформе!');
         });
         $msg = 'Вам был послан емайл, он содержит линк и пароль для подтверждения вашего емайла, ';
         return Redirect::to('/')->with('msg', $msg);
     }
 }
开发者ID:fencer-md,项目名称:stoticlle,代码行数:34,代码来源:UserController.php

示例2: postCreate

 public function postCreate()
 {
     $vCode = str_random(120);
     $emailChecker = User::where('email', '=', Input::get('email'))->first();
     if (!empty($emailChecker)) {
         return 3;
     }
     $unameChecker = User::where('username', '=', Input::get('uname'))->first();
     //if(!empty($unameChecker))
     //{
     //return 4;
     //}
     $user = new User();
     $user->email = Input::get('email');
     $user->username = Input::get('uname');
     if (!empty(Input::get('pass'))) {
         $user->password = Hash::make(Input::get('pass'));
     } else {
         $tempPass = str_random(6);
         $user->password = Hash::make($tempPass);
     }
     $user->vCode = $vCode;
     if ($user->save()) {
         $userInfo = new UserInfo();
         $userInfo->user_id = $user['id'];
         $userInfo->lastname = Input::get('lname');
         $userInfo->firstname = Input::get('fname');
         $userInfo->middleInitial = Input::get('mname');
         $userInfo->address = Input::get('address');
         $userInfo->contactNo = Input::get('contact');
         $userInfo->email = Input::get('email');
         if ($userInfo->save()) {
             if (!empty(Input::get('pass'))) {
                 $emailcontent = array('username' => $user->username, 'link' => URL::route('confirmation', [$vCode, $user->id]));
                 Mail::send('emails.confirmation.index', $emailcontent, function ($message) {
                     $message->to(Input::get('email'), 'Kalugdan Garden Resort')->subject('Kalugdan Garden Resort Confirmation Email');
                 });
                 return 1;
             } else {
                 $emailcontent = array('tempPass' => $tempPass, 'email' => Input::get('email'), 'username' => $user->username, 'link' => URL::route('confirmation', [$vCode, $user->id]));
                 Mail::send('emails.confirmation.walk-in', $emailcontent, function ($message) {
                     $message->to(Input::get('email'), 'Kalugdan Garden Resort')->subject('Kalugdan Garden Resort Confirmation Email');
                 });
                 return 1;
             }
         }
     } else {
         //return View::make('index')->with('mt', "HOME")->with('alert', 'fail')->with('msg', 'An error occured while creating the user. Please try again.');
         //return Redirect::Route('home')->with('fail','An error occured while creating the user. Please try again.');
         return 2;
     }
 }
开发者ID:jhunel2389,项目名称:baeyaya-dev,代码行数:52,代码来源:UserController.php

示例3: addAttr

 public static function addAttr($uid, $type, $name, $value)
 {
     if (!$uid || !$type || !$name || !$value) {
         return false;
     }
     $info = UserInfo::model()->find("uid={$uid} AND classify='{$type}' AND name='{$name}'");
     if (!$info) {
         $data = array('uid' => $uid, 'classify' => $type, 'name' => $name, 'value' => $value);
         $model = new UserInfo();
         $model->attributes = $data;
         return $model->save();
     } else {
         return UserInfo::model()->updateByPk($info['id'], array('value' => $value));
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:15,代码来源:UserInfo.php

示例4: actionRegister

 /**
  * 新用户注册
  *
  */
 public function actionRegister()
 {
     $this->layout = " ";
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery-1.9.1.js');
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/login.css');
     $username = Yii::app()->request->getQuery('username', null);
     $phone = Yii::app()->request->getQuery('phone', null);
     $email = Yii::app()->request->getQuery('email', null);
     $model = new User('create');
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         if ($model->validate()) {
             $code_model = Temp::model()->findByPk(trim($model->phone));
             if (!empty($code_model)) {
                 if (time() - $code_model->time <= 180) {
                     if ($model->sms_code == $code_model->code) {
                         if ($model->save()) {
                             $userInfo = new UserInfo();
                             $userInfo->userId = $model->id;
                             $userInfo->username = $model->username;
                             $userInfo->phone = $model->phone;
                             $userInfo->save();
                             $this->redirect(array('registerSuccess'));
                         }
                     } else {
                         $model->addError('sms_code', '验证码不正确');
                     }
                 } else {
                     $model->addError('sms_code', '验证码已失效,请重新获取');
                 }
             } else {
                 $model->addError('sms_code', '验证失败,请重新获取');
             }
         }
     }
     if (!empty($username) && trim($username) != '您的姓名') {
         $model->username = $username;
     }
     if (!empty($phone) && trim($phone) != '您的电话') {
         $model->phone = $phone;
     }
     if (!empty($email) && trim($email) != '您的邮箱') {
         $model->email = $email;
     }
     $sms_list = Sms::model()->findAll();
     $link_list = Link::model()->findAll();
     $this->render('create', array('model' => $model, 'sms_data' => $sms_list[0], 'link_list' => $link_list));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:52,代码来源:UserController.php

示例5: actionRegistration

 public function actionRegistration()
 {
     $msg = '';
     $model = new UserForm('registration');
     if (Yii::app()->request->isPostRequest && !empty($_POST['UserForm'])) {
         $model->setAttributes($_POST['UserForm']);
         if ($model->validate()) {
             $user = new UserModel();
             $user->setAttributes(['email' => $model->email, 'type' => $model->type, 'password' => UserModel::model()->cryptPass($pass = UserModel::model()->genPassword()), 'hash' => $hash = UserModel::model()->genHash($pass)], FALSE);
             $user->save();
             $info = new UserInfo();
             $info->setAttributes(['user_id' => $user->id, 'name' => $model->name, 'surname' => $model->surname], FALSE);
             $info->save();
             Yii::app()->email->send($model->email, 'Регистрация', 'Ваш пароль:' . $pass . '. Для подтверждения учетной записи перейдите по ссылке: ' . $this->createAbsoluteUrl('access/accept', ['hash' => $hash]));
             $msg = 'Спасибо за регистрацию! проверти почту';
         }
     }
     $this->render('registration', ['model' => $model, 'msg' => $msg]);
 }
开发者ID:snipesn,项目名称:pravoved,代码行数:19,代码来源:AccessController.php

示例6: saveInfo

 public function saveInfo()
 {
     $fname = Input::get('fname');
     $lname = Input::get('lname');
     $mname = Input::get('mname');
     $address = Input::get('address');
     $contact = Input::get('contact');
     $email = Input::get('email');
     $getInformation = new UserInfo();
     $getInformation['firstname'] = $fname;
     $getInformation['lastname'] = $lname;
     $getInformation['middleInitial'] = $mname;
     $getInformation['address'] = $address;
     $getInformation['contactNo'] = $contact;
     $getInformation['email'] = $email;
     if ($getInformation->save()) {
         $allReserves = UserInfo::all();
         foreach ($allReserves as $allReserve) {
             $response[] = array("reserve_id" => $allReserve['id'], "fname" => $allReserve['firstname'], "lname" => $allReserve['lastname'], "mname" => $allReserve['middleInitial'], "address" => $allReserve['address'], "contact" => $allReserve['contactNo'], "email" => $allReserve['email']);
         }
     }
     return $response;
 }
开发者ID:jhunel2389,项目名称:baeyaya-dev,代码行数:23,代码来源:FileMaintenanceController.php

示例7: register

 /**
  * Logs in the user using the given name and password in the model.
  * @return boolean whether login is successful
  */
 public function register()
 {
     $user = new User();
     $userInfo = new UserInfo();
     $user->email = $this->email;
     $user->plainPassword = $this->password;
     if ($user->save()) {
         $userInfo->id = $user->getPrimaryKey();
         $userInfo->email = $user->email;
         $userInfo->name = $this->name;
         $userInfo->bio = $this->bio;
         //			$userInfo->status="created";
         $userInfo->addTime = time();
         $userInfo->status = "created";
         if ($userInfo->save()) {
             /**
              * added by lsy 20130819
              * assign roles after registration HERE
              */
             //	$authorizer = Yii::app()->getModule("rights")->getAuthorizer();
             //	$authorizer->authManager->assign('Authenticated', $userInfo->id);
             /**
              * added by lsy 20130819
              */
             //注册成功后自动登录
             //$identity=new UserIdentity($this->email,$this->password);
             //$identity->authenticate();
             //Yii::app()->user->login($identity,0);
             //			Yii::import("ext.sendcloud.ESendCloud");
             //	$sendCloud = new ESendCloud();
             return true;
         } else {
             $user->delete();
         }
     }
     return false;
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:41,代码来源:RegisterForm.php

示例8: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new UserInfo();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['UserInfo'])) {
         $model->attributes = $_POST['UserInfo'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->userId));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:17,代码来源:UserController.php

示例9: addUser

 public function addUser($usuario)
 {
     log::info("creacion usuario");
     $data['usuario'] = $usuario;
     $nombre = isset($data['usuario']['nombre']) ? $data['usuario']['nombre'] : '';
     $ap = isset($data['usuario']['apellido_paterno']) ? $data['usuario']['apellido_paterno'] : '';
     $am = isset($data['usuario']['apellido_materno']) ? $data['usuario']['apellido_materno'] : '';
     $id_tipo_donador = isset($data['usuario']['id_tipo_donador']) ? $data['usuario']['id_tipo_donador'] : '';
     $donacion = isset($data['usuario']['donacion_info']) ? $data['usuario']['donacion_info'] : '';
     $username = isset($data['usuario']['username']) ? $data['usuario']['username'] : '';
     $password = isset($data['usuario']['password']) ? $data['usuario']['password'] : '';
     //die();
     if (!$data['usuario']) {
         return false;
     }
     $usuario = User::select('username')->where('username', '=', $data['usuario']['username'])->first();
     if (count($usuario) > 0) {
         log::info("dada");
         return Response::json(array('error' => "500", 'error_message' => "Ya existe un usuario con esta cuenta"));
     } else {
         try {
             $usuarioInfo = new UserInfo();
             $usuarioInfo->nombre = trim($nombre);
             $usuarioInfo->apellido_paterno = trim($ap);
             $usuarioInfo->apellido_materno = trim($am);
             $usuarioInfo->id_tipo_donador = trim($id_tipo_donador);
             $usuarioInfo->donacion_info = trim($donacion);
             $usuarioInfo->save();
             log::info("inseted");
             log::info($usuarioInfo);
             if ($data['usuario']['contacto']) {
                 $usuario = UserInfo::find($usuarioInfo->id_usuario_info);
                 $arrContactos = array();
                 log::info("find");
                 log::info($usuario);
                 log::info("contacto");
                 log::info($usuario->contactos);
                 $usuario->contactos()->detach();
                 if ($data['usuario']['contacto'] && is_array($data['usuario']['contacto'])) {
                     foreach ($data['usuario']['contacto'] as $value) {
                         $arrContactos[] = array('id_tipo_contacto' => $value['tipo'], 'dato' => $value['valor']);
                     }
                 }
                 $usuario->contactos()->attach($arrContactos);
             }
             $login = new User();
             $login->username = trim($username);
             $login->password = md5(trim($password));
             $login->id_usuario_info = $usuarioInfo->id_usuario_info;
             $login->save();
             return Response::json(array('error' => "200", 'error_message' => 'Se han guardado los datos'));
         } catch (Exception $ex) {
             return Response::json(array('error' => "500", 'error_message' => $ex->getMessage()));
         }
     }
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:56,代码来源:SincronizacionController.php

示例10: connectSamebookUser

 protected function connectSamebookUser($samebookUser)
 {
     $user = User::model()->findByAttributes(array('email' => $samebookUser['email']));
     if (!$user) {
         $user = new User();
         $user->email = $samebookUser['email'];
         $user->password = $samebookUser['pwd'];
         $user->salt = $samebookUser['salt'];
         if ($user->save()) {
             $userInfo = new UserInfo();
             $userInfo->name = $samebookUser['username'];
             $userInfo->id = $user->getPrimaryKey();
             $userInfo->email = $user->email;
             $userInfo->introduction = $samebookUser['bio'];
             $userInfo->addTime = time();
             $userInfo->status = 'ok';
             $userInfo->save();
         }
     }
     $userInfo = UserInfo::model()->findByAttributes(array('email' => $samebookUser['email']));
     //列入oauth表
     if (empty($userInfo->oauth)) {
         $oauth = new Oauth();
         $oauth->userId = $user->id;
         $oauth->save();
     }
     $userInfo = UserInfo::model()->findByAttributes(array('email' => $samebookUser['email']));
     //在oauth表中加sbid
     if (!$userInfo->oauth->sbid) {
         $userInfo->oauth->sbid = $samebookUser['userId'];
         $userInfo->oauth->save();
         $userInfo = User::model()->findByAttributes(array('email' => $samebookUser['email']));
     }
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:34,代码来源:OauthController.php

示例11: actionInit

 public function actionInit()
 {
     $model = new InstallInfoForm();
     $mailer = new MailerForm();
     if (isset($_POST['InstallInfoForm']) && isset($_POST['MailerForm'])) {
         $model->attributes = $_POST['InstallInfoForm'];
         $siteForm = new SiteForm();
         $siteForm->name = $model->name;
         $siteForm->subTitle = $model->subTitle;
         $siteForm->saveSetting();
         $user = new User();
         $user->email = $model->adminEmail;
         $user->setPlainPassword($model->adminPassword);
         $user->save();
         $userInfo = new UserInfo();
         $userInfo->name = $model->adminName;
         $userInfo->id = $user->getPrimaryKey();
         $userInfo->email = $user->email;
         $userInfo->bio = $model->adminBio;
         $userInfo->isAdmin = 1;
         //			$userInfo->roles = "superAdmin,admin,teacher";
         $userInfo->status = "ok";
         $userInfo->addTime = time();
         $userInfo->introduction = "admin";
         $mailer->attributes = $_POST['MailerForm'];
         if ($userInfo->save() && $mailer->saveSetting()) {
             $auth = Yii::app()->authManager;
             $auth->createRole('admin');
             $auth->createRole('teacher');
             $userInfo->roles = array('admin', 'teacher');
             $this->setNav();
             $this->setCarousel();
             Yii::app()->user->setFlash('success', '系统初始化成功!');
             $this->redirect(array('finish'));
         }
     }
     $this->render('init', array('model' => $model, 'mailer' => $mailer));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:38,代码来源:InstallController.php

示例12: postRegister

 public function postRegister()
 {
     $input = Input::only('username', 'email', 'password', 'confirm_password', 'g-recaptcha-response');
     $validator_error_messages = ['g-recaptcha-response.required' => 'reCAPTCHA verification is required.'];
     $validator = Validator::make($input, array('username' => 'required|alpha_dash|unique:users', 'email' => 'required|email|unique:users', 'password' => 'required|min:8', 'confirm_password' => 'required|same:password', 'g-recaptcha-response' => 'required|recaptcha'), $validator_error_messages);
     if ($validator->fails()) {
         return Redirect::action('UserController@getRegister')->withErrors($validator)->withInput();
     }
     $user = new User();
     $confirmation = str_random(64);
     $user->username = $input['username'];
     $user->email = $input['email'];
     $user->password = Hash::make($input['password']);
     $user->is_active = 1;
     $user->register_ip = Request::getClientIp();
     $user->last_ip = Request::getClientIp();
     $user->confirmation = $confirmation;
     if ($user->save()) {
         $user_info = new UserInfo();
         $user_info->user_id = $user->id;
         $user->last_ip = Request::getClientIp();
         $user_info->save();
         Mail::send('emails.auth.confirmation', array('confirmation' => $confirmation), function ($message) use($input) {
             $message->from('noreply@modpackindex.com', 'Modpack Index');
             $message->to($input['email'], $input['username'])->subject('Confirmation for ' . $input['username']);
         });
         return View::make('user.register_success', ['email' => $user->email]);
     }
     return Redirect::action('UserController@getRegister')->withErrors(['Error' => 'Unable to create account'])->withInput();
 }
开发者ID:helkarakse,项目名称:modpackindex,代码行数:30,代码来源:UserController.php

示例13: addUser

 /**
  *添加一个用户
  */
 public function addUser($email, $password, $info = array())
 {
     $user = new User();
     $user->plainPassword = $password;
     $user->email = $email;
     //用户名不可缺少
     if ($user->save()) {
         $userInfo = new UserInfo();
         $userInfo->id = $user->getPrimaryKey();
         $userInfo->email = $user->email;
         $attributes = $userInfo->getAttributes();
         foreach ($info as $k => $v) {
             if (in_array($k, $attributes)) {
                 $userInfo->{$k} = $v;
             }
         }
         $userInfo->addTime = time();
         if ($userInfo->save()) {
             return true;
         } else {
             $user->delete();
         }
     }
     return false;
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:28,代码来源:User.php

示例14: actionInformation

 /**
  * Displays the login page
  */
 public function actionInformation($id = -1)
 {
     if ($id == -1) {
         $user = User::model()->findByAttributes(array('user_name' => Yii::app()->user->name));
         if (!$user) {
             $this->redirect(array('/'));
         }
         $user_info = UserInfo::model()->findByPk($user->id);
         if (!$user_info) {
             $user_info = new UserInfo();
         }
         if (isset($_POST['UserInfo'])) {
             if (in_array(Yii::app()->user->isAdmin(), [4])) {
                 Yii::app()->user->setFlash('error', '无更改权限');
                 $this->render('information', array('user_info' => $user_info));
             }
             $user_info->attributes = $_POST['UserInfo'];
             $user_info->vocational_certificate = $_POST['UserInfo']['vocational_certificate'];
             foreach ($user_info->attributes as $k => $v) {
                 if (!strlen($v) && !$v) {
                     unset($user_info[$k]);
                 }
             }
             $user_info->id = $user->id;
             $user_info->ip = $_SERVER['REMOTE_ADDR'];
             if ($user_info->save()) {
                 Yii::app()->user->setFlash('success', '更改成功');
             } else {
                 Yii::app()->user->setFlash('error', '更改失败');
                 $this->render('information', array('user_info' => $user_info));
                 Yii::app()->end();
             }
         }
         $this->render('information', array('user_info' => $user_info));
     } else {
         if (Yii::app()->user->isAdmin() == 0) {
             $this->redirect(array('/site/index'));
         }
         $user_info = UserInfo::model()->findByPk($id);
         $this->render('information', array('user_info' => $user_info));
     }
 }
开发者ID:FavorMylikes,项目名称:RescurimentManager,代码行数:45,代码来源:SiteController.php

示例15: save

 /**
  * [Persist a User]
  * @param  User   $user [description]
  * @return [type]       [description]
  */
 public function save(UserInfo $user)
 {
     return $user->save();
 }
开发者ID:prateekk16,项目名称:Pluto,代码行数:9,代码来源:UserInfoRepository.php


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