feat(profile): add username + preferred_locale; wire to Inertia + middleware
- DB: users.username (unique), users.preferred_locale (default from app.locale) - Backend: validation, model fillable; share supportedLocales; SetLocaleFromUser - Frontend: profile page fields + types - Filament: SuperAdmin profile page with username/language feat(admin-nav): move Tasks to Bibliothek and add menu labels fix(tasks-table): show localized title/emotion/event type; add translated headers feat(l10n): add missing table headers for emotions and event types; normalize en/de files refactor: tidy translations for tasks/emotions/event types
This commit is contained in:
@@ -16,6 +16,20 @@ class ProfileUpdateRequest extends FormRequest
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$supportedLocales = collect(explode(',', (string) env('APP_SUPPORTED_LOCALES', 'de,en')))
|
||||
->map(fn ($l) => trim((string) $l))
|
||||
->filter()
|
||||
->unique()
|
||||
->values()
|
||||
->all();
|
||||
|
||||
if (empty($supportedLocales)) {
|
||||
$supportedLocales = array_values(array_unique(array_filter([
|
||||
config('app.locale'),
|
||||
config('app.fallback_locale'),
|
||||
])));
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
|
||||
@@ -27,6 +41,19 @@ class ProfileUpdateRequest extends FormRequest
|
||||
'max:255',
|
||||
Rule::unique(User::class)->ignore($this->user()->id),
|
||||
],
|
||||
|
||||
'username' => [
|
||||
'nullable',
|
||||
'string',
|
||||
'max:32',
|
||||
Rule::unique(User::class)->ignore($this->user()->id),
|
||||
],
|
||||
|
||||
'preferred_locale' => [
|
||||
'required',
|
||||
'string',
|
||||
Rule::in($supportedLocales),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user