Escolasoft
Published in

Escolasoft

Quick tip. How to change Laravel user password from command line.

When you search google on how to change / reset user password most tips includes changing this from the database. Yet there is imho better way that use Laravels Tinker

Laravel REPL

All Laravel applications include Tinker, a REPL powered by the PsySH package. Tinker allows you to interact with your entire Laravel application on the command line, including the Eloquent ORM, jobs, events, and more. To enter the Tinker environment, run the tinker Artisan command:

Chaning password (or any other Model data)

Launch the console from main folder with

php artisan tinker

After that you enters Laravels console — all commands from now are interpreted as php code. So to change user@example.com password you would just run.

$user = App\User::where('email', 'user@example.com')->first();
$user->password = Hash::make('password');
$user->save();

That’s it. Password changed.

--

--

--

Stories from creative software house based in Poland, with a love for all web technology

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mateusz Wojczal

Mateusz Wojczal

founder of Qunabu Interactive from Gdańsk, Poland. Full-stack web developer with over a dozen years of experience.

More from Medium

Laravel 8

Add And Store Data In Laravel 8

Laravel — Installation

Installation laravel

Laravel 9