Sunday, April 16, 2017

How do I enter password into database as hashed in Laravel?

$this->validate(request(), [
    'name' => 'required',
    'email' => 'required|email',
    'password' => 'required|confirmed'
  ]);

  $user = User::create(request(['name', 'email', 'password']));

I have the above code in my current controller to receive data from the user registration form and it properly enters the user into the Users table in the Database. However, the password is not hashed, and I am wondering what is the correct method of storing hashed passwords in Laravel? (and what is the official hash to use in Laravel?) I'm following along a Laracasts.com tutorial.



via Simon Suh

Advertisement