I am trying to create an hashed password for Laravel. Now someone told me to use Laravel hash helper but I can't seem to find it or I'm looking in the wrong direction.
How do I create a laravel hashed password? And where?
Edit: I know what the code is but I don't know where and how to use it so it gives me back the hashed password. If I get the hashed password then I can manually insert it into the database
Hashing A Password Using Bcrypt in
Laravel
:This will create a hashed password. You may use it in your controller or even in a model, for example, if a user submits a password using a form to your controller using
POST
method then you may hash it using something like this:Here,
$hashed
will contain the hashed password. Basically, you'll do it when creating/registering a new user, so, for example, if a user submits details such as,name
,email
,username
andpassword
etc using a form, then before you insert the data into database, you'll hash the password after validating the data. For more information, read the documentation.Update:
So, you'll insert the
$hashedPassword
into database. Hope, it's clear now and if still you are confused then i suggest you to read some tutorials, watch some screen casts on laracasts.com and tutsplus.com and also read a book onLaravel
, this is a free ebook, you may download it.Update: Since
OP
wants to manually encrypt password using LaravelHash
without any class or form so this is an alternative way usingartisan tinker
from command prompt:Laravel
installation (your project's root directory)cd <directory name>
and press enter from command prompt/terminalphp artisan tinker
and press enterecho Hash::make('somestring');
Update (Laravel 5.x):