Reputation: 49
After running php artisan tinker I create an User:
App\User::create(['email' => '[email protected]', 'password' => '123456'])
=> App\User {#723
email: "[email protected]",
updated_at: "2015-10-13 17:33:58",
created_at: "2015-10-13 17:33:58",
id: 6,
}
Why does the following command return false?
Auth::attempt(['email' => '[email protected]', 'password' => '123456'])
=> false
How shall Auth::attempt be used?
Upvotes: 0
Views: 307
Reputation: 91
Laravel uses bcrypt to hash passwords. If you create the user following way:
App\User::create(['email' => '[email protected]', 'password' => bcrypt(123456)]);
Auth::attempt(['email' => '[email protected]', 'password' => '123456']);
will work.
Upvotes: 2