['required', 'string'], ]; } public function mount(): void { $this->role = $this->user?->role_name; } #[Computed] public function user(): User { return $this->id ? User::where('ulid', $this->id)->first() : new User; } #[Computed] public function roles(): array { return Role::select(['name']) ->get() ->pluck('name', 'name') ->toArray(); } public function save(UpdateUserRole $updateUserRole): void { try { $this->validate(); $updateUserRole->execute($this->user, [$this->role]); $this->dispatch('hide-role-selection-modal'); $this->dispatch('refresh-user-data'); $this->success(__('domains/identity/messages.success.user_role_updated')); } catch (Exception $e) { $this->warning($e->getMessage()); } } public function hide(): void { $this->resetValidation(); $this->resetErrorBag(); $this->dispatch('role-clear'); } };