move into sonardesk

This commit is contained in:
Mark Gregory
2026-10-12 14:50:13 +01:00
parent 5f0d2ceb72
commit 38b4a7406f
879 changed files with 24021 additions and 1 deletions
@@ -0,0 +1,46 @@
<?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::create('locales', function (Blueprint $table): void {
$table->id();
$table->string('code', 20)->unique();
$table->string('name', 100);
$table->string('native_name', 100);
$table->string('regional_code', 20)->nullable();
$table->string('direction', 3)->default('ltr');
$table->string('date_format', 40)->default('d/m/Y');
$table->string('time_format', 40)->default('H:i');
$table->string('timezone', 80)->default('UTC');
$table->string('currency_code', 3)->nullable();
$table->string('currency_symbol', 10)->nullable();
$table->unsignedInteger('position')->default(0);
$table->boolean('is_default')->default(false);
$table->boolean('is_active')->default(true);
$table->timestamps();
});
Schema::create('localized_contents', function (Blueprint $table): void {
$table->id();
$table->morphs('translatable');
$table->foreignId('locale_id')->constrained()->cascadeOnDelete();
$table->string('field', 100);
$table->longText('value')->nullable();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
$table->unique(['translatable_type', 'translatable_id', 'locale_id', 'field'], 'localized_content_unique');
$table->index(['locale_id', 'field']);
});
}
public function down(): void
{
Schema::dropIfExists('localized_contents');
Schema::dropIfExists('locales');
}
};
@@ -0,0 +1,19 @@
<?php
namespace Modules\Localization\Database\Seeders;
use Illuminate\Database\Seeder;
use Modules\Localization\Models\Locale;
final class LocaleSeeder extends Seeder
{
public function run(): void
{
Locale::query()->updateOrCreate(['code' => 'en'], [
'name' => 'English', 'native_name' => 'English', 'regional_code' => 'en-GB',
'direction' => 'ltr', 'date_format' => 'd/m/Y', 'time_format' => 'H:i',
'timezone' => config('app.timezone', 'UTC'), 'currency_code' => 'GBP',
'currency_symbol' => '£', 'position' => 0, 'is_default' => true, 'is_active' => true,
]);
}
}