當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。