Skip to content
Advertisement

Data type of ‘password’ field for manual input in phpmyadmin for Laravel application?

In my Laravel application I have two type of Users. One is ‘Admin’ and another is ‘Users’.

For Admin I want to input an ‘username’ and ‘password’ manually to the database. So what’s the data type of the ‘password’ field of ‘users’ table for manual input ?

I have tried with ‘SHA1’. But while I trying to login for that ‘Admin’ it gives error.

controller login

public function admin_login(Request $request)
{
    $validator = $request->validate([
        'username'     => 'required',
        'password'  => 'required|min:6'
    ]);

    if (Auth::attempt($validator)) {
        return redirect()->route('dashboard');
    }
}

phpmyadmin enter image description here

Anybody help please ? Thanks in advance ?

Advertisement

Answer

let me clear one thing here is that Larvel uses Hash “bcrypt”, “argon”, “argon2id” driver to hashing the string. That is specific to the programming language, not the database language.

You could run

php artisan tinker

in your console and after.

echo Hash::make('admin_password_whatever_you_like')

You will get the string and copy this string and save it into the database without calling any MySQL method.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement