label(__('Username')) ->maxLength(32) ->unique(ignoreRecord: true); } protected function getPreferredLocaleFormComponent(): Component { $supported = collect(explode(',', (string) env('APP_SUPPORTED_LOCALES', 'de,en'))) ->map(fn ($l) => trim((string) $l)) ->filter() ->unique() ->values() ->all(); if (empty($supported)) { $supported = array_values(array_unique(array_filter([ config('app.locale'), config('app.fallback_locale'), ]))); } $options = collect($supported)->mapWithKeys(fn ($l) => [$l => strtoupper($l)])->all(); return Select::make('preferred_locale') ->label(__('Language')) ->required() ->options($options); } public function form(Schema $schema): Schema { return $schema ->components([ $this->getNameFormComponent(), $this->getEmailFormComponent(), $this->getUsernameFormComponent(), $this->getPreferredLocaleFormComponent(), $this->getPasswordFormComponent(), $this->getPasswordConfirmationFormComponent(), $this->getCurrentPasswordFormComponent(), ]); } }