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


PHP User::save方法代碼示例

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


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

示例1: userList

 /**
 Method to get information about the logged in user
 @param void
 @return view
 */
 public function userList()
 {
     if (!Auth::check()) {
         return Redirect::to('/');
     }
     $message = '';
     if (Request::isMethod('post')) {
         $data = Input::except('_token');
         $password = Hash::make(Input::get('password'));
         $user = new User();
         $user->name = Input::get('name');
         $user->email = Input::get('email');
         $user->password = $password;
         $username = Input::get('name');
         $userEmail = Input::get('email');
         if ($user->save()) {
             try {
                 Mail::send('emails.welcome', ['userEmail' => $username], function ($m) use($userEmail, $username) {
                     $m->to($userEmail, $username)->subject('Express Rental');
                 });
             } catch (Exception $ex) {
             }
             $message = 'Added Successfully';
             return Redirect::to('/users/list')->with('message', $message);
         } else {
             $message = 'Addition not Successfully';
             return Redirect::to('/users/list')->withErrors('message', $message);
         }
     } else {
         $allUserInfo = DB::table('users')->orderBy('users.id', 'DESC')->paginate(5);
         return view('Home.list')->with(compact('allUserInfo'));
     }
 }
開發者ID:sddcronjob,項目名稱:expressrental,代碼行數:38,代碼來源:HomeController.php

示例2: emailReminder

 /**
  * @testdox Requesting a password reminder adds an item to the Mail Queue.
  * @test
  */
 public function emailReminder()
 {
     $user = new User(['username' => 'test']);
     $user->save();
     $user->sendPasswordReminder();
     $this->assertEquals(1, QueuedEmail::count());
 }
開發者ID:samwilson,項目名稱:asset-manager,代碼行數:11,代碼來源:UserTest.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = new User($request->all());
     $user->email = $user->account . env('DOMAIN');
     $user->password = bcrypt($user->password);
     $user->save();
     return $this->redirectWithSuccessFlash('user', "您已經新增了使用者<b>{$user->username}</b>");
 }
開發者ID:jocoonopa,項目名稱:lubri,代碼行數:14,代碼來源:UserController.php

示例4: create

 /**
  * Create and save a new user.
  *
  * @param array
  */
 public function create()
 {
     // Validate input
     $params = array('username' => $this->app->request->post('username'), 'email_address' => $this->app->request->post('email_address'), 'password_hash' => Password::hash($this->app->request->post('password')));
     $user = new User($params);
     $user->save();
     $this->app->redirectTo('home');
 }
開發者ID:spencerbaer,項目名稱:CS457Project,代碼行數:13,代碼來源:UserController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StoreRequest $request)
 {
     //
     $users = new User();
     $users->fill(['name' => $request->name, 'email' => $request->email]);
     //var_dump($users); die;
     $users->save();
     return redirect()->action('UserController@index');
 }
開發者ID:joceline-putra,項目名稱:ecommerce-laravel,代碼行數:15,代碼來源:UserController.php

示例6: save

 /**
  * Saves a user in the database.
  *
  * @param string $name
  * @param string $username
  * @param string $password
  * @param string $role
  *
  * @return Response
  */
 public static function save($name, $username, $password, $role)
 {
     $user = new User();
     $user->name = $name;
     $user->username = $username;
     $user->password = $password;
     $user->role = $role;
     $user->save();
 }
開發者ID:Munk91,項目名稱:Hovedopgave,代碼行數:19,代碼來源:UserRepository.php

示例7: registerUser

 public function registerUser($name, $email, $password)
 {
     $user = new User();
     $user->password = is_null($password) ? null : bcrypt($password);
     $user->email = $email;
     $user->save();
     $profile = new Profile();
     $profile->name = $name;
     $profile->user_id = $user->id;
     $profile->description = "";
     $profile->save();
     return $user;
 }
開發者ID:tinkanketsu,項目名稱:hello-world,代碼行數:13,代碼來源:AuthService.php

示例8: userData

 public function userData($userData, $userId)
 {
     $user = User::find($userId);
     //Check if user exist
     if (!$user) {
         $user = new User();
     }
     $user->name = $userData['name'];
     $user->email = $userData['email'];
     $user->password = Hash::make($userData['password']);
     $user->save();
     return $user;
 }
開發者ID:haster312,項目名稱:laravel_rikkei,代碼行數:13,代碼來源:UserBusiness.php

示例9: postRegister

 public function postRegister(Request $request)
 {
     $time = time();
     $user = new UserModel();
     $user->usr_name = $request->input('usr_name');
     $user->usr_email = $request->input('usr_email');
     $user->usr_password = Hash::make($request->input('usr_password'));
     $user->usr_access_token = md5(uniqid($time, $request->input('usr_email')));
     $user->usr_reset_token = md5(uniqid($time, $request->input('usr_email')));
     $user->usr_active_fg = true;
     $user->rol_id = 1;
     if (!$user->save()) {
         return 'error';
     }
 }
開發者ID:sochea09,項目名稱:laravel-blog,代碼行數:15,代碼來源:AuthAdmin.php

示例10: register

 /**
  * Register an account
  * POST
  *
  * @param Request $request
  * @return Response
  */
 public function register(Request $request)
 {
     $this->validate($request, ['login' => 'required|min:5|alpha_num|unique:accounts,account', 'password' => 'required|min:4', 'mail' => 'required|email', 'username' => 'required|alpha_num|unique:accounts,pseudo', 'question' => 'required', 'answer' => 'required', 'cu' => 'required', 'rules' => 'required']);
     $user = new UserManager();
     $user->account = $request->login;
     $user->pass = $request->password;
     $user->email = $request->mail;
     $user->pseudo = $request->username;
     $user->level = 0;
     $user->question = $request->question;
     $user->reponse = $request->answer;
     $user->code = $this->_generateCode(24);
     $user->save();
     Auth::login($user);
     return redirect()->route('join');
 }
開發者ID:Synthx,項目名稱:Acamar,代碼行數:23,代碼來源:UserController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['first_name' => 'required|alpha|max:255', 'last_name' => 'required|alpha|max:255', 'email' => 'required|email|unique:users|max:255', 'password' => 'required|min:6']);
     if ($validator->fails()) {
         return Redirect::to(route('user.create'))->withErrors($validator)->withInput();
     } else {
         $user = new User();
         $user->first_name = $request->first_name;
         $user->last_name = $request->last_name;
         $user->email = $request->email;
         $user->password = bcrypt($request->password);
         $user->save();
         Session::flash('info', 'Successfully created');
         return Redirect::to(route('user.index'));
     }
 }
開發者ID:rtyshyk,項目名稱:binary-studio-library-task,代碼行數:21,代碼來源:UserController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request, Guard $auth)
 {
     $v = \Validator::make($request->all(), ['email' => 'required|email', 'username' => 'required|max:255', 'password' => 'required|confirmed']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors());
     }
     $user = new User();
     if (User::whereEmail($request->input('email'))->count() < 1 && User::whereUsername($request->input('username'))->count() < 1) {
         $user->username = $request->input('username');
         $user->email = $request->input('email');
         $user->password = \Hash::make($request->input('password'));
         if ($user->save()) {
             \Auth::login($user);
             return redirect()->route('tasks.index');
         }
     }
     return redirect()->back()->with("NOTIF_INFO", "Email or Username have been registered");
 }
開發者ID:abidnurulhakim,項目名稱:qa-crawler,代碼行數:23,代碼來源:SiteController.php

示例13: register

 function register(Request $request)
 {
     $name = $request->input('name');
     $email = $request->input('email');
     $password = sha1($request->input('password'));
     $exist_user = User::where('email', $email)->count();
     if ($exist_user == 0) {
         $user = new User();
         $user->name = $name;
         $user->email = $email;
         $user->password = $password;
         $user->save();
         $result = array('success' => true, 'message' => 'register success.');
     } else {
         $result = array('success' => false, 'message' => 'email is existing.');
     }
     return $result;
 }
開發者ID:ninekao099,項目名稱:travelmate,代碼行數:18,代碼來源:UserController.php

示例14: register

 public static function register($postData)
 {
     $user = User::where('email', $postData['email'])->first();
     if ($user) {
         return false;
     } else {
         $postData['password'] = md5($postData['password']);
         unset($postData['retype']);
         $newUser = new User();
         foreach ($postData as $key => $value) {
             $newUser->{$key} = $value;
         }
         $newUser->save();
         unset($newUser['password']);
         return $newUser;
     }
     return false;
 }
開發者ID:huynhtrucquyen0812,項目名稱:sifoni-blog,代碼行數:18,代碼來源:User.php

示例15: registerSaveAction

 public function registerSaveAction($request, $response)
 {
     $this->validator->rule('required', ['username', 'email', 'password', 'first_name', 'last_name']);
     $this->validator->rule('email', 'email');
     if ($this->validate()) {
         $input = $request->getParsedBody();
         $user = new User();
         $user->username = $input['username'];
         $user->email = $input['email'];
         $user->password = password_hash($input['password'], PASSWORD_DEFAULT);
         $user->first_name = $input['first_name'];
         $user->last_name = $input['last_name'];
         $save = $user->save();
         if ($save) {
             $this->flash->addMessage('success', 'Register Success');
         }
     }
     return $response->withRedirect($this->router->pathFor('registerPage'));
 }
開發者ID:choirulafandi,項目名稱:slim-skeleton,代碼行數:19,代碼來源:AuthController.php


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