当前位置: 首页>>代码示例>>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;未经允许,请勿转载。