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


PHP Hash::needsRehash方法代码示例

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


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

示例1: setAdminPassAttribute

 /**
  * 密码调整器
  *
  * @param $password
  */
 public function setAdminPassAttribute($password)
 {
     if (Hash::needsRehash($password)) {
         $password = Hash::make($password);
     }
     $this->attributes['admin_pass'] = $password;
 }
开发者ID:netxinyi,项目名称:meigui,代码行数:12,代码来源:Admin.php

示例2: saving

 function saving($model)
 {
     ///////////
     // RULES //
     ///////////
     $rules['name'] = ['required'];
     $rules['password'] = ['required', 'min:8'];
     $rules['gender'] = ['required', 'in:pria,wanita'];
     $rules['dob'] = ['date', 'date_format:Y-m-d'];
     $rules['email'] = ['email', 'unique:users,email,' . ($model->_id ? $model->_id : 'NULL') . ',_id'];
     $rules['phone'] = ['string'];
     //////////////
     // VALIDATE //
     //////////////
     $data = $model->toArray();
     $data['password'] = $model->password;
     $validator = Validator::make($data, $rules);
     if ($validator->fails()) {
         $model->setErrors($validator->messages());
         return false;
     }
     // Hash password
     if (Hash::needsRehash($data['password'])) {
         $model->password = Hash::make($data['password']);
     }
 }
开发者ID:erickmo,项目名称:CapcusAPI,代码行数:26,代码来源:UserObserver.php

示例3: saving

 /**
  * @param $user
  * Hashes the users password if the developer wasn't already hashing it via an other method
  * such as an attribute
  * @return bool
  */
 public function saving($user)
 {
     if (Hash::needsRehash($user->password)) {
         $user->password = Hash::make($user->password);
     }
     return true;
 }
开发者ID:eflames,项目名称:vault,代码行数:13,代码来源:UserObserver.php

示例4: setPasswordAttribute

 /**
  * Hash the users password.
  *
  * @param $value
  */
 public function setPasswordAttribute($value)
 {
     if (Hash::needsRehash($value)) {
         $this->attributes['password'] = bcrypt($value);
     } else {
         $this->attributes['password'] = $value;
     }
 }
开发者ID:mikimaine,项目名称:ecommerce,代码行数:13,代码来源:UserAttribute.php

示例5: setPasswordAttribute

 public function setPasswordAttribute($password)
 {
     if (Hash::needsRehash($password)) {
         $this->attributes['password'] = Hash::make($password);
     } else {
         $this->attributes['password'] = $password;
     }
 }
开发者ID:lc0991,项目名称:Todo,代码行数:8,代码来源:User.php

示例6: rehashPassword

 /**
  * Check if the user's password needs rehashing.
  */
 public function rehashPassword($password)
 {
     if (!Hash::needsRehash($this->getAttributeFromArray('password'))) {
         return;
     }
     if (!$this->confirmPassword($password)) {
         return;
     }
     $this->setPasswordAttribute($password);
     return $this->save();
 }
开发者ID:anlutro,项目名称:l4-core,代码行数:14,代码来源:PasswordModelTrait.php

示例7: getLogicButtonAttribute

 /**
  * @return string
  */
 public function getLogicButtonAttribute()
 {
     // ajax route for creating new question
     $logicurl = route('ajax.project.question.addlogic', [$this->project->id, $this->id]);
     // get ajax urlhash for project
     $hash = $this->urlhash;
     if (isset($hash['logic'])) {
         $urlhash = $hash['logic'];
     } else {
         $urlhash = '';
     }
     // check if rehash need or not
     if (Hash::needsRehash($urlhash)) {
         // rehash if urlhash column in project table empty or invalid
         $hash['logic'] = Hash::make($logicurl);
         // update project table in database with new or correct urlhash
         $this->update(['urlhash' => $hash]);
     }
     $id = snake_case("{$this->qnum} -lgbtn");
     $dataid = snake_case("{$this->qnum} -btn");
     return '<a data-href="' . $logicurl . '" id=" ' . $id . '" data-modal="' . $dataid . '" href="#" class="btn btn-xs btn-primary ' . $dataid . '" data-toggle="modal" data-target="#logic" data-type="edit"><i class="fa fa-info" data-toggle="tooltip" data-placement="top" title="Add Logic"  ></i></a>';
 }
开发者ID:herzcthu,项目名称:Laravel-HS,代码行数:25,代码来源:Question.php

示例8: setPasswordAttribute

 public function setPasswordAttribute($value)
 {
     if (strlen($value) < 3) {
         return;
     }
     $this->attributes['password'] = Hash::needsRehash($value) ? bcrypt($value) : $value;
 }
开发者ID:GiedriusQ,项目名称:taksistas,代码行数:7,代码来源:User.php


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