/home/bdqbpbxa/dev-subdomains/api-uniferx.goodface.com.ua/app/Console/Commands/ChangePassword.php
<?php

namespace App\Console\Commands;

use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;

class ChangePassword extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:change-password';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        $email = $this->ask("Enter the user's email");
        $user = User::query()->where('email', $email)->first();
        if ($user) {
            $password = $this->secret('Enter the new password');
            $password_duplicate = $this->secret('Enter the new password again');
            if ($password === $password_duplicate) {
                $user->update([
                    'password' => Hash::make($password),
                ]);

            } else {
                $this->error('Passwords do not match');
            }
        } else {
            $this->error('User not found');
        }
        $this->info('The command was successful!');
    }
}