How to change a Users Password via Tinker in Laravel

Laravel has a pretty great console through a REPL called Tinker.

From Tinker you can interact with your models.

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

Super convenient! You just need SSH access to a server in the environment in which the app is running. I like to setup an "ops" box that lives in my production environment that is only accessible through a VPN. This gives me a management console to my app for emergencies or whatever!

Even better is to launch a docker container on demand that only runs for the session and is killed when you exit Tinker. Anyways, I have become very accustomed to the Ruby on Rails console so having Tinker around is incredibly comforting :D

Did you like this post? Let me know by sending me a message. Is there a topic you would like me to cover? Let me know about that too. I look forward to hearing from you!

Let's Connect!