Skip to main content
Maher Sakka
Main navigation
  • Home
  • Contact me
Language switcher
Breadcrumb
  1. Home
  2. Blog
  3. How To Reset a User Password In a Laravel Project From Console

How to reset a User password in a Laravel project from console

We can use Tinker to change a Laravel user password from the console using theses instructions.

Start Tinker

php artisan tinker

The shell is launched

Psy Shell v0.12.9 (PHP 8.2.4 — cli) by Justin Hileman
>

Select the concerned user by email

> $user = App\Models\User::where('email', '[email protected]')->first();
= App\Models\User {#7434
    id: 24,
    name: "Maher",
    last_name: "Sakka",
    email: "[email protected]",
    phone: null,
    status: 1,
    previous_status: null,
    login_count: null,
    last_login_at: null,
    email_verified_at: null,
    #password: "$2y$12$IE0iNZZRA0X7c5TkWpZR8.ifAeG74TYnS5ZR7f255H87l0pmVP0Pq",
    two_factor_secret: null,
    two_factor_recovery_codes: null,
    two_factor_confirmed_at: null,
    #remember_token: null,
    created_at: "2025-07-23 11:04:36",
    updated_at: "2025-07-23 11:04:36",
    image_file_name: null,
    image_mime_type: null,
    image_path: null,
  }

Update the password

> $user->password = Hash::make('new_secure_password');
= "$2y$12$VN9L24jBW3Vyu73WDHq9COVQu4oxIqrYFJWvkT1iWYbMfOGaehzKi"

Save the record

> $user->save();
= true

and done !

Tags
  • Laravel
Related posts
  • How to check if email are sent correctly in a Laravel Project
  • Fix the problem of Please provide a valid cache path in Laravel
Tags
  • Laravel
  • Linux
  • Drupal
  • Database
  • Tips & Tricks
  • Mobile
Recent posts
  • How to reset a User password in a Laravel project from console
  • How to check if email are sent correctly in a Laravel Project
  • How to Find Recently Modified Files in Linux
Monthly archive
  • May 2017 (2)
  • August 2018 (1)
  • October 2020 (1)
  • August 2023 (1)
  • July 2024 (2)
  • November 2024 (1)
  • July 2025 (10)
  • October 2025 (2)
Projects
  • elmanager.tn
  • 365mathex.com
  • vpop.tn
  • toufoula.tn
  • writethemoney.com
  • dinartunisien.com
RSS feed

mahersakka.com © 2024