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:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('users', 'username')) {
|
||||
$table->string('username', 32)->nullable()->unique()->after('email');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('users', 'preferred_locale')) {
|
||||
$defaultLocale = config('app.locale', 'en');
|
||||
$table->string('preferred_locale', 5)->default($defaultLocale)->after('role');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('users', 'username')) {
|
||||
try { $table->dropUnique(['username']); } catch (\Throwable $e) { /* ignore */ }
|
||||
$table->dropColumn('username');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('users', 'preferred_locale')) {
|
||||
$table->dropColumn('preferred_locale');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user