zofe / rapyd-laravel

deprecated rewritten in rapyd-livewire
MIT License
866 stars 298 forks source link

Saving password with Hash::make() #290

Open mo-zag opened 8 years ago

mo-zag commented 8 years ago

Hi I want to save password with Hash::make($value) through the forms but by default password is not hashed is there a work around for this?

Thanks MO

zofe commented 8 years ago

a mutator is a good option: https://laravel.com/docs/master/eloquent-mutators#accessors-and-mutators

another one if you're using a dataform is overwriting..

...
$form->saved(function() use ($form)
 {
  $form->model->pwd = Hash::make(\Input::get(' pwd'));
  $form->model->save();
}
mo-zag commented 8 years ago

Ok Zofe thanks for the prompt response awesome work by the way.

Thanks Mo

chliguiy commented 8 years ago

public function setPasswordAttribute($password) {
$this->attributes['password'] = bcrypt($password); } make this function in User.php model