Files
fotospiel-app/app/Http/Requests/Settings/ProfileUpdateRequest.php
SEB Fotografie - soeren fc1e64fea3 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
2025-09-11 21:17:19 +02:00

60 lines
1.5 KiB
PHP

<?php
namespace App\Http\Requests\Settings;
use App\Models\User;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProfileUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
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'],
'email' => [
'required',
'string',
'lowercase',
'email',
'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),
],
];
}
}