'dashboard', 'domains/identity/seo.user.title' => 'users.index', '{name}' => ''], context: 'user')] #[Seo(title: 'domains/identity/seo.user_detail.title', context: 'user')] class extends Component { use HasLayoutDataAttributes; use HasSeoAttributes; use WithToast; #[Locked] public ?string $id = null; public function mount(string $user_id): void { $this->id = $user_id; } #[On('refresh-user-data')] #[Computed] public function user(): ?User { return $this->id ? User::with('profile') ->where('ulid', $this->id) ->first() : new User; } #[On('send-password-reset')] public function sendResetPassword(SendPasswordResetLink $sendLink): void { try { $sendLink->execute(new ForgotPasswordDTO( email: $this->user->email, )); $this->dispatch('send-password-reset-completed'); $this->success(__('domains/identity/messages.success.password_reset_link_sent')); } catch (Exception $e) { $this->dispatch('send-password-reset-failed', message: $e->getMessage()); } } #[On('toggle-user-status')] public function toggleStatus(SuspendUser $suspendUser, ActivateUserStatus $activateUserStatus): void { try { if ($this->user->status->isActive()) { $suspendUser->execute($this->user); } else { $activateUserStatus->execute($this->user); } $this->dispatch('toggle-user-status-completed'); $this->success(__('domains/identity/messages.success.user_status_updated')); } catch (Exception $e) { $this->dispatch('toggle-user-status-failed', message: $e->getMessage()); } } };