當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserService::save方法代碼示例

本文整理匯總了PHP中UserService::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserService::save方法的具體用法?PHP UserService::save怎麽用?PHP UserService::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserService的用法示例。


在下文中一共展示了UserService::save方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: register

 public function register()
 {
     $this->validate(array('name' => 'required,min(2)', 'email' => 'required,email', 'password' => 'required,min(4)', 'password2' => 'required,min(4),equal(password)'));
     $userDoc = Request::post()->get('name', 'email', 'password');
     $userDoc->password = md5($userDoc->password);
     $userDoc = UserService::save($userDoc);
     if (!$userDoc) {
         MessageHandler::instance()->addError('E-mail was already registered - forgot your password?');
         return;
     }
     $user = new UserModel($userDoc);
     SessionHandler::instance()->setUser($user);
     MessageHandler::instance()->addMessage('You were successfully registered and logged in');
     $this->redirect();
 }
開發者ID:hofmeister,項目名稱:ScrumBanana.com,代碼行數:15,代碼來源:UserController.php

示例2: actionUpdate

 public function actionUpdate()
 {
     $model = UserService::loadModel();
     $this->performAjaxValidation($model);
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         if (UserService::save($model)) {
             Flashes::addInfoFlash(Yii::t('amo', 'User updated successfully'));
             $this->redirect(array('view', 'id' => $model->uid));
         } else {
             Flashes::addErrorFlash(Yii::t('amo', 'Could not update the user.') . '  ' . Yii::t('amo', 'Please, try again later.'));
         }
     }
     $this->render('update', array('model' => $model));
 }
開發者ID:CHILMEX,項目名稱:amocasion,代碼行數:15,代碼來源:UserController.php

示例3: editAction

 public function editAction($id)
 {
     $this->response->setTemplate('user-edit');
     $user_service = new UserService();
     $this->response->view->success = "";
     $this->response->view->error = "";
     if ($this->response->getPost() && $user_service->save($this->response->getPost())) {
         #salvo com sucesso
         $this->response->view->success = "Funcionario salvo com sucesso.";
         $this->indexAction();
     } elseif ($this->response->getPost()) {
         /**
          * Mostrar o motivo do porque nao foi salvo
          */
         $this->response->view->error = "Precisa preencher todos os campos obrigatorios!!!";
     }
     $user = $user_service->get($id);
     $this->response->view->user = $user;
 }
開發者ID:richarddaros,項目名稱:seminovo24h,代碼行數:19,代碼來源:userview.php

示例4: User

<?php

require __DIR__ . "/../autoload.php";
$user = new User();
$user->setName("Zachary");
$userService = new UserService();
$userService->save($user);
開發者ID:JoshuaReneDalley,項目名稱:php,代碼行數:7,代碼來源:verifyUserService.php


注:本文中的UserService::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。