argument('email')); $this->info("Verifica esistenza utente per email: {$email}..."); $user = User::query()->where('email', $email)->first(); if (! $user instanceof User) { $this->error("Errore: nessun utente trovato con l'indirizzo email {$email}."); return self::FAILURE; } $this->info("Utente trovato: {$user->name} (ID: {$user->id}, Ruoli: " . $user->roles->pluck('name')->join(', ') . ")"); $broker = Password::broker(Filament::getAuthPasswordBroker()); $token = $broker->createToken($user); $notification = app(NetGesconResetPasswordNotification::class, ['token' => $token]); try { $panel = Filament::getPanel('admin-filament'); $url = $panel->getResetPasswordUrl($token, $user); } catch (\Throwable) { $url = url(route('filament.admin-filament.auth.password-reset.reset', [ 'token' => $token, 'email' => $user->getEmailForPasswordReset(), ], false)); } $notification->url = $url; $this->info("Invio email in corso a {$email} via SMTP (Google Workspace / NetGescon)..."); try { $user->notify($notification); $this->info("Email inviata con successo!"); $this->line("Link di ripristino generato: {$url}"); return self::SUCCESS; } catch (\Throwable $e) { $this->error("Errore durante l'invio dell'email: " . $e->getMessage()); return self::FAILURE; } } }