where('email', strtolower((string) $this->argument('email')))->first(); if ($user === null) { $this->error('There is no account with that email address.'); return self::FAILURE; } if ($this->option('generate')) { $password = Str::password(20, symbols: false); } else { $password = (string) $this->secret('New password (min 12 characters)'); if (mb_strlen($password) < 12) { $this->error('The password must be at least 12 characters.'); return self::FAILURE; } if ($password !== (string) $this->secret('Once more')) { $this->error('The two passwords are not the same.'); return self::FAILURE; } } $user->forceFill(['password' => Hash::make($password)])->save(); $this->info("New password for {$user->email} is set."); $this->option('generate') && $this->line($password); return self::SUCCESS; } }