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


PHP User::save方法代码示例

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


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

示例1: getLogin

 public function getLogin()
 {
     if ($this->steam->validate()) {
         $info = $this->steam->getUserInfo();
         if (!is_null($info)) {
             try {
                 $user = User::where('steamid', $info->getSteamID())->first();
                 if (is_null($user)) {
                     $user = new User();
                     $user->name = $info->getNick();
                     $user->steamid = $info->getSteamID();
                     $user->profileURL = $info->getProfileURL();
                     $user->save();
                 }
                 if ($user->name != $info->getNick() || $user->profileURL != $info->getProfileURL()) {
                     $user->name = $info->getNick();
                     $user->profileURL = $info->getProfileURL();
                     $user->save();
                 }
                 Auth::login($user);
                 return Redirect::to('/');
             } catch (Illuminate\Database\Eloquent\ModelNotFoundException $ex) {
             }
         }
     } else {
         return $this->steam->redirect();
         //redirect to steam login page
     }
 }
开发者ID:alaevka,项目名称:voblerbox,代码行数:29,代码来源:SteamController.php

示例2: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->info('This command will create or update a user account.');
     $this->info('Submit "cancel" as the value to cancel anytime.');
     $email = $this->ask('Email address', '');
     if ($email == 'cancel') {
         $this->info('Cancelled.');
         return;
     }
     $user = User::where('email', $email)->first();
     if (is_null($user)) {
         $this->info('A new user account will be created.');
         $password = $this->secret('Choose a password');
         if ($password == 'cancel') {
             $this->info('Cancelled.');
             return;
         }
         $user = new User();
         $user->email = $email;
         $user->password = bcrypt($password);
         $user->save();
         $this->info('New user created.');
     } else {
         $this->info('Entering edit mode for this account.');
         $password = $this->secret('Choose a new password:');
         $user->password = bcrypt($password);
         $user->save();
         $this->info('User updated.');
     }
 }
开发者ID:clarkwinkelmann,项目名称:forms,代码行数:35,代码来源:CreateUserCommand.php

示例3: register

 public function register(Request $request)
 {
     $farmChecking = $request->input("farmID");
     $usernameCheck = $request->input("username");
     $user = new User();
     if (User::where("username", "=", $usernameCheck)->count() == 0) {
         $user->name = $request->input("name");
         $user->lastname = $request->input("lastname");
         $user->username = $request->input("username");
         $user->password = Hash::make($request->input("password"));
         $user->email = $request->input("email");
         $user->role = $request->input("role");
         $user->phoneNumber = $request->input("phoneNumber");
         if ($farmChecking != 0 || $farmChecking != null) {
             $farmID = ($farmChecking - 320001) / 100;
             if (Farm::find($farmID) != null) {
                 $farm = Farm::find($farmID);
                 $user->save();
                 $user->farm()->save($farm);
             } else {
                 return response()->json(['error' => 'Wrong Farm ID'], 501);
             }
         } else {
             $user->save();
         }
     } else {
         return response()->json(['error' => 'duplicate username'], 502);
     }
     return $user::where("username", "=", $user->username)->first();
 }
开发者ID:bossgame1234,项目名称:MS4SF,代码行数:30,代码来源:userController.php

示例4: postUsers

 public function postUsers(Request $request, User $user)
 {
     try {
         $input = $request->input('user');
         $email = $input['email'];
         $password = $input['password'];
         $confirm_password = $input['password_confirmation'];
         $validator = \Validator::make(['email' => $email, 'password' => $password, 'confirm_password' => $confirm_password], ['email' => 'required|email|unique:users', 'password' => 'required', 'confirm_password' => 'required|same:password']);
         if ($validator->fails()) {
             return response()->json(['error' => $validator->messages()], 422);
             // return response()->json((['error'=>'The email address has already been used.']), 422);
         }
         if ($password == $confirm_password) {
             $user->email = $email;
             $user->password = bcrypt($password);
             $user->token_type = 'Bearer';
             $user->role = 'user';
             $user->save();
             $hash = substr(bcrypt($user->password), 0, 20);
             $user->access_token = $hash;
             $user->save();
             // $_POST['user_id'] = $user->id;
             // $attribute = new AttributeController;
             // $attr = $attribute->postInit();
             $content = ['email' => $email, 'token_type' => $user->token_type, 'user_id' => $user->id, 'access_token' => $user->id . ':' . $user->access_token];
             return response()->json($content, 200);
         }
     } catch (Exception $e) {
         return response()->json(['error' => $e->getMessage()], 422);
     }
 }
开发者ID:nyrnzn,项目名称:beautimetreapi,代码行数:31,代码来源:UserController.php

示例5: postRegister

 public function postRegister(RegisterRequest $request)
 {
     $this->user->name = $request->name;
     $this->user->email = $request->email;
     $this->user->password = bcrypt($request->password);
     $this->user->save();
     return redirect('auth/login');
 }
开发者ID:lshakeel,项目名称:WE_Assignment3,代码行数:8,代码来源:AuthController.php

示例6: postRegister

 /**
  * Handle a registration request for the application.
  *
  * @param  RegisterRequest  $request
  * @return Response
  */
 public function postRegister(RegisterRequest $request)
 {
     //code for registering a user goes here.
     $this->user->email = $request->email;
     $this->user->password = bcrypt($request->password);
     $this->user->save();
     $this->auth->login($this->user);
     return redirect('/dash-board');
 }
开发者ID:sherazali123,项目名称:laravel-5-mysql-login-registration,代码行数:15,代码来源:AuthController.php

示例7: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $this->user->email = $this->email;
     $this->user->verified = false;
     $this->user->save();
     foreach ($this->user->emailChangeRequest() as $request) {
         $request->token = null;
         $request->save();
     }
 }
开发者ID:Teamelite,项目名称:Dashboard,代码行数:15,代码来源:ChangeEmailAddress.php

示例8: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $password = Str::random(8);
     $this->user->password = $password;
     $this->user->save();
     // Mail user
     Mail::queue('auth.emails.reset', ["user" => $this->user, "password" => $password], function ($message) {
         $message->to($this->user->email);
         $message->subject('New password.');
     });
 }
开发者ID:Teamelite,项目名称:Dashboard,代码行数:16,代码来源:ResetPassword.php

示例9: postRegister

 public function postRegister(RegisterRequest $request)
 {
     $this->auth->login($this->user);
     $this->user->email = $request->email;
     $this->user->username = $request->username;
     $this->user->password = bcrypt($request->password);
     $this->user->dept_name = $request->dept_name;
     $this->user->user_type = $request->user_type;
     $this->user->save();
     return redirect('/auth/login');
 }
开发者ID:nahid1991,项目名称:LoginTest,代码行数:11,代码来源:AuthController.php

示例10: postRegister

 /**
  * Handle a registration request for the application.
  *
  * @param  RegisterRequest  $request
  * @return Response
  */
 public function postRegister(RegisterRequest $request)
 {
     $this->user->nama = $request->nama;
     $this->user->username = $request->username;
     $this->user->password = bcrypt($request->password);
     $this->user->jenisKelamin = $request->jenisKelamin;
     $this->user->ttl = $request->ttl;
     $this->user->alamat = $request->alamat;
     $this->user->no_tlp = $request->no_tlp;
     $this->user->save();
     //code for registering a user goes here.
     $this->auth->login($this->user);
     return redirect('login');
 }
开发者ID:CyMas,项目名称:Tabline,代码行数:20,代码来源:AuthController.php

示例11: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Facebook $fb)
 {
     try {
         $response = $fb->get('/me?fields=' . implode($this->changedFields, ','), $this->user->token)->getGraphUser();
     } catch (FacebookAuthenticationException $e) {
         return false;
     }
     foreach ($response as $field => $value) {
         if (in_array($field, $this->changedFields)) {
             $this->user->{$field} = $value;
         }
     }
     $this->user->save();
 }
开发者ID:wearehx,项目名称:voting,代码行数:19,代码来源:UpdateUser.php

示例12: store

 public function store(Registration_validate $request)
 {
     $request->all();
     $User1 = new User(array('First_name' => $request->get('fn'), 'Last_name' => $request->get('ln'), 'Username' => $request->get('un'), 'password' => bcrypt($request->get('ps')), 'Mobile_number' => $request->get('mn')));
     $User1->save();
     return redirect('/Login');
 }
开发者ID:bsvarunreddy2007,项目名称:Portal,代码行数:7,代码来源:RegisterController.php

示例13: create

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

示例14: update

 /**
  * Update the specified user in storage.
  *
  * @param User $user
  * @param UserRequest $request
  * @return Response
  */
 public function update(User $user, UserRequest $request)
 {
     $data = $this->storeImage($request, 'picture');
     $user->fill($data);
     $user->save() == true ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
     return redirect(route('admin.user.index'));
 }
开发者ID:abada,项目名称:laravel-5-simple-cms,代码行数:14,代码来源:UserController.php

示例15: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(UserRequest $request)
 {
     $user = new User($request->except('password', 'password_confirmation'));
     $user->password = bcrypt($request->password);
     $user->confirmation_code = str_random(32);
     $user->save();
 }
开发者ID:coralhust,项目名称:Laravel-5-Bootstrap-3-Starter-Site,代码行数:12,代码来源:UserController.php


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