I have created a website with login form for the administrator. I have the admin table in my database. I added the values in the table but when I try to login, the password is not being accepted. My table is as below
How can I set username and password for admins using database table?
Advertisement
Answer
You should create a hash for the password and I will suggest to use tinker. Just goto your project directory via cmd and type this command
php artisan tinker
Then Enter below lines to create admin. I assume you have admin model for the admins table!
$admin = new AppAdmin; $admin->name= "admin"; $admin->email="admin@admin.com"; $admin->password= Hash::make('password'); $admin->save();