eporsche / daybreak

Simple timesheets and vacation management for small businesses.
MIT License
129 stars 38 forks source link

[Suggestion] - Language #13

Closed Nejcc closed 3 years ago

Nejcc commented 3 years ago

I suggest insted using enum in user migration use relation id

current

  public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            ...
            $table->enum('locale', ['de','en'])->default('en');
        });
    }

Replace with

current

  public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            ...
            $table->unasignedBigInteger('language_id')->default(1);
        });
    }

Also make

 php artisan make:model Utilities/Language -m
 Schema::create('languages', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('name_short')->unique();
            $table->string('country_code')->unique();
            $table->string('code')->unique();
            $table->timestamps();
        });

 Language::truncate();

 Language::create([
    'name'              => 'English',
    'name_short'    => 'en',
    'country_code' => 'gb',
    'code'               => 'gb',
]);

And for better usage put in .env.example AND .env LANGUAGE_DEFAULT=de

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.