Added the ability to dynamically translate on the project website.

This commit is contained in:
2024-04-22 23:52:04 +05:00
parent a648ba3db9
commit 491249c8d8
55 changed files with 867 additions and 119 deletions

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('project_languages', function (Blueprint $table) {
$table->unsignedInteger('system_lang')->nullable()->after('sort');
$table->string('iso_code', 30)->nullable()->after('system_lang');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('project_languages', function (Blueprint $table) {
$table->dropColumn('system_lang');
$table->dropColumn('iso_code');
});
}
};

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('project_translations', function (Blueprint $table) {
$table->id();
$table->string('code');
$table->text('text');
$table->unsignedBigInteger('project_id')->index();
$table->foreign('project_id')->references('id')->on('projects');
$table->unsignedBigInteger('language_id')->index();
$table->foreign('language_id')->references('id')->on('project_languages');
$table->timestamps();
$table->softDeletes();
$table->index(['project_id', 'language_id', 'deleted_at']);
$table->unique(['project_id', 'language_id', 'code']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('project_translations');
}
};