laravelhashpasswords

how to implement the code below in laravel for a password


i am following along a video course from tutsplus -getting started with laravel- and managed up to vid 19 securing the admin panel. My problem as follows. i cannot login to the system because i don't have a valid email-password. in the db there are dummy user emails and hashed pw's but i cannot use because already hashed and i don't know the pw's.

i found this post How to create a laravel hashed password

however artisan tinker doesn't work because REPL not supported.Falling back to simple shell.

$password = 'JohnDoe';
$hashedPassword = Hash::make($password);
echo $hashedPassword; // $2y$10$jSAr/RwmjhwioDlJErOk9OQEO7huLz9O6Iuf/udyGbHPiTNuB3Iuy

makes sense - to create a new user with known pw but i don't know where and how to implement the code so it spits out the hash in the browser. I tried making a file in the model as well as route and stuck in the code.. to no avail. or maybe easier way? Can someone help thx.


Solution

  • Place this in your routes.php

    Route::get('hash/{password}', function($password){
        echo Hash::make($password);
    });
    

    And then open your-project.dev/hash/JohnDoe in your browser.