argument('email'); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $this->error('Invalid email format'); return; } $user = User::where('email', $email)->first(); if (!$user) { $this->error("User with email '{$email}' not found"); return; } if (!$this->confirm("Are you sure you want to reset the password for user with email '{$email}'?")) { $this->info('Operation cancelled.'); return; } // Make a strong password $password = Str::password(16); $user->forceFill([ 'password' => Hash::make($password), ])->setRememberToken(Str::random(60)); $user->save(); // Output the new password to the console $this->info("Password for user with email '{$email}' has been reset."); $this->info("New password: {$password}"); } protected function promptForMissingArgumentsUsing(): array { return [ 'email' => 'What is the user\'s email address?', ]; } }