/** * Set the user's password. * * @param string $value * * @return string */ public function setPasswordAttribute($value) { if (\Hash::needsRehash($value)) { $value = bcrypt($value); } $this->attributes['password'] = $value; }
public static function boot() { parent::boot(); static::saving(function ($user) { if (Hash::needsRehash($user->password)) { $user->password = \Hash::make($user->password); } }); }
public function updating($model) { /** @var \Rgv151\Spratly\User $model */ if (empty($model->password)) { $model->password = $model->getOriginal('password'); } if (Hash::needsRehash($model->password)) { $model->password = Hash::make($model->password); } }
public function fire() { $string = $this->argument('string'); $hash = $this->argument('hash'); if (\Hash::check($string, $hash) === false) { $this->error('Compare: not match!'); } else { $this->info('Compare: match!'); } if (\Hash::needsRehash($hash)) { $this->info('Your hash needs to be rehashed.'); } }
/** * 密码 * @param string $value 未处理的密码字符串 * @return void */ public function setPasswordAttribute($value) { // 若传入的字符串已经进行了 Hash 加密,则不重复处理 $this->attributes['password'] = Hash::needsRehash($value) ? Hash::make($value) : $value; }
/** * Adjuster: Password * @param string $value Untreated password string * @return void */ public function setPasswordAttribute($value) { // If the incoming string has been encrypted Hash, the iterative process is not $this->attributes['password'] = Hash::needsRehash($value) ? Hash::make($value) : $value; }