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


PHP Authenticatable::save方法代码示例

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


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

示例1: updateRememberToken

 /**
  * Update the "remember me" token for the given user in storage.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  string                                     $token
  * @return void
  */
 public function updateRememberToken(Authenticatable $user, $token)
 {
     if ($user->exists) {
         $user->setRememberToken($token);
         $user->save();
     }
 }
开发者ID:ssddanbrown,项目名称:bookstack,代码行数:14,代码来源:LdapUserProvider.php

示例2: validateCredentials

 public function validateCredentials(UserContract $user, array $credentials)
 {
     $plain = $credentials['password'];
     $okay = DataSource::check_login($user->user_id, $plain);
     if ($okay) {
         $user->password = \Crypt::encrypt($plain);
         $user->save();
     }
     return $okay;
 }
开发者ID:oeed,项目名称:Keystone-Next,代码行数:10,代码来源:KeystoneUserProvider.php

示例3: verify

 /**
  * This controller function handles the submission form
  *
  * @param Request $request Current User Request
  * @param Authenticatable $user Current User
  * @param AuthyApi $authyApi Authy Client
  * @return mixed Response view
  */
 public function verify(Request $request, Authenticatable $user, AuthyApi $authyApi, Client $client)
 {
     $token = $request->input('token');
     $verification = $authyApi->verifyToken($user->authy_id, $token);
     if ($verification->ok()) {
         $user->verified = true;
         $user->save();
         $this->sendSmsNotification($client, $user);
         return redirect()->route('user-index');
     } else {
         $errors = $this->getAuthyErrors($verification->errors());
         return view('verifyUser', ['errors' => new MessageBag($errors)]);
     }
 }
开发者ID:TwilioDevEd,项目名称:account-verification-laravel,代码行数:22,代码来源:UserController.php

示例4: saveProfile

 /**
  * Изменение данных в профиле пользователя
  * @param Authenticatable $user
  * @param Request $request
  */
 public function saveProfile(Authenticatable $user, Request $request)
 {
     if (!Auth::check()) {
         return false;
     }
     $v = Validator::make(['age' => $request->input('age')], ['age' => 'required|integer|between:1,150']);
     if ($v->fails()) {
         // Переданные данные не прошли проверку
         return response(array('msg' => 'Неверно указан возраст'))->header('Content-Type', 'application/json');
     }
     $user->age = $request->input('age');
     $user->save();
     return response(array('msg' => 'Профиль сохранён'))->header('Content-Type', 'application/json');
 }
开发者ID:Nexor0,项目名称:test,代码行数:19,代码来源:UsersController.php

示例5: validateCredentials

 /**
  * {@inheritdoc}
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     // Check if we have an authenticated AD user.
     if ($this->user instanceof User) {
         // We'll save the authenticated model in case of changes.
         $user->save();
         return true;
     }
     if ($this->getLoginFallback() && $user->exists) {
         // If the user exists in our local database already and fallback is
         // enabled, we'll perform standard eloquent authentication.
         return parent::validateCredentials($user, $credentials);
     }
     return false;
 }
开发者ID:adldap2,项目名称:adldap2-laravel,代码行数:18,代码来源:DatabaseUserProvider.php

示例6: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  array  $credentials
  * @return bool
  */
 public function validateCredentials(UserContract $user, array $credentials)
 {
     $plain = $credentials['password'];
     $legacyHasher = $user->getAuthObject();
     if ($legacyHasher !== false) {
         if (!$legacyHasher->check($plain, $user->getAuthPassword())) {
             return false;
         }
         $user->password = $this->hasher->make($plain);
         $user->password_legacy = null;
         $user->save();
         return true;
     }
     return $this->hasher->check($plain, $user->getAuthPassword());
 }
开发者ID:GodOfConquest,项目名称:infinity-next,代码行数:22,代码来源:EloquentUserProvider.php

示例7: updateUserInfo

 /**
  * 寫入登入時間及IP 位址
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return void
  */
 public function updateUserInfo(UserContract $user)
 {
     // 寫入登入IP & 時間
     $user->ip_address = Request::ip();
     $user->last_login = Carbon::now();
     $user->save();
     // 寫入可用權限以供nav 選單使用
     $role = json_decode($user->role->permissions);
     if (in_array('all', $role)) {
         $permissions = Permission::select('slug')->where('status', true)->get()->toArray();
         // dd($permissions);
     } else {
         $permissions = Permission::select('slug')->whereIn('slug', $role)->where('status', true)->get()->toArray();
     }
     // dd($role);
     foreach ($permissions as $value) {
         $permission[] = $value['slug'];
     }
     // dd($permission);
     session(['permissions' => $permission]);
     // dd(session('permissions'));
 }
开发者ID:denise92,项目名称:cms,代码行数:28,代码来源:EloquentUserProvider.php

示例8: syncModelFromAdldap

 /**
  * Fills a models attributes by the specified Users attributes.
  *
  * @param User            $user
  * @param Authenticatable $model
  *
  * @return Authenticatable
  */
 protected function syncModelFromAdldap(User $user, Authenticatable $model)
 {
     $attributes = $this->getSyncAttributes();
     foreach ($attributes as $modelField => $adField) {
         $model->{$modelField} = $this->getSyncAttribute($user, $adField);
     }
     $sync_on_empty_attributes = $this->getSyncOnEmptyAttributes();
     foreach ($sync_on_empty_attributes as $modelField => $adField) {
         if (empty($model->{$modelField})) {
             $model->{$modelField} = $this->getSyncAttribute($user, $adField);
         }
     }
     if ($model instanceof Model) {
         $model->save();
     }
     return $model;
 }
开发者ID:NogaevPN,项目名称:Adldap2-Laravel,代码行数:25,代码来源:AdldapAuthUserProvider.php

示例9: changePassword

 /**
  * Reset the given user's password.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function changePassword(Authenticatable $user, Request $request)
 {
     $this->validate($request, ['password' => 'required|confirmed|min:6']);
     $password = $request->get('password');
     $user->password = bcrypt($password);
     if ($user->save()) {
         return Response::json(['message' => 'Password changed sucessfully', 'type' => 'success', 'title' => 'Success'], 201);
     } else {
         return Response::json(['message' => $e->getMessage(), 'type' => 'error', 'title' => 'Error'], 400);
         return $this->error($e->getMessage());
     }
 }
开发者ID:litepie,项目名称:user,代码行数:19,代码来源:UserAdminController.php

示例10: updateRememberToken

 /**
  * Update the "remember me" token for the given user in storage.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  string                                     $token
  *
  * @return void
  */
 public function updateRememberToken(Authenticatable $user, $token)
 {
     if ($this->use_remember_me == TRUE) {
         if ($this->log_logins) {
             Log::debug('login.updaterememberme.enabled', ['username_clean' => $user->username_clean, 'token' => $token]);
         }
         $user->setRememberToken($token);
         $user->save();
     } else {
         if ($this->log_logins) {
             Log::debug('login.updaterememberme.disabled', ['username_clean' => $user->username_clean, 'token' => $token]);
         }
     }
 }
开发者ID:Aurorastation,项目名称:Web-Interface,代码行数:22,代码来源:PhpbbUserProvider.php

示例11: onLogin

 /**
  * Actions to run upon login
  * @param  Authenticatable $user
  * @return void
  */
 public function onLogin(Authenticatable $user)
 {
     $user->last_login_at = $user->login_at;
     $user->login_at = new DateTime();
     $user->save();
 }
开发者ID:ruysu,项目名称:laravel-core,代码行数:11,代码来源:AuthListener.php

示例12: syncModelFromAdldap

 /**
  * Fills a models attributes by the specified Users attributes.
  *
  * @param User            $user
  * @param Authenticatable $model
  *
  * @return Authenticatable
  */
 protected function syncModelFromAdldap(User $user, Authenticatable $model)
 {
     $attributes = $this->getSyncAttributes();
     foreach ($attributes as $modelField => $adField) {
         if ($this->isAttributeCallback($adField)) {
             $value = $this->handleAttributeCallback($user, $adField);
         } else {
             $value = $this->handleAttributeRetrieval($user, $adField);
         }
         $model->{$modelField} = $value;
     }
     if ($model instanceof Model) {
         $model->save();
     }
     return $model;
 }
开发者ID:ProyectoSanClemente,项目名称:proyectoapi,代码行数:24,代码来源:AdldapAuthUserProvider.php

示例13: syncModelFromAdldap

 /**
  * Fills a models attributes by the specified Users attributes.
  *
  * @param User            $user
  * @param Authenticatable $model
  *
  * @return Authenticatable
  */
 protected function syncModelFromAdldap(User $user, Authenticatable $model)
 {
     $attributes = $this->getSyncAttributes();
     foreach ($attributes as $modelField => $adField) {
         if ($adField === ActiveDirectory::THUMBNAIL) {
             // If the field we're retrieving is the users thumbnail photo, we need
             // to retrieve it encoded so we're able to save it to the database.
             $adValue = $user->getThumbnailEncoded();
         } else {
             $adValue = $user->{$adField};
             if (is_array($adValue)) {
                 // If the AD Value is an array, we'll
                 // retrieve the first value.
                 $adValue = Arr::get($adValue, 0);
             }
         }
         $model->{$modelField} = $adValue;
     }
     if ($model instanceof Model) {
         $model->save();
     }
     return $model;
 }
开发者ID:rakesh-beedasy,项目名称:Adldap2-Laravel,代码行数:31,代码来源:AdldapAuthUserProvider.php

示例14: updateRememberToken

 /**
  * Update the "remember me" token for the given user in storage.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  string $token
  * @return void
  */
 public function updateRememberToken(UserContract $user, $token)
 {
     $user->setRememberToken($token);
     /** @var DbObject $user */
     $user->save();
 }
开发者ID:swayok,项目名称:PeskyCMF,代码行数:13,代码来源:PeskyOrmUserProvider.php

示例15: updateUser

 /**
  * Change the password for a given user
  * @param  Request          $request
  * @param  Authenticatable  $user
  * @return Illuminate\Http\Response
  */
 protected function updateUser(Request $request, Authenticatable $user)
 {
     $user->fill($request->all());
     return $user->save();
 }
开发者ID:ruysu,项目名称:laravel-core,代码行数:11,代码来源:EditsUser.php


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