mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 00:02:15 +01:00
Add localization settings
This commit is contained in:
committed by
Gregor Vostrak
parent
3c9160a08a
commit
ae00fdb0e9
@@ -4,6 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\CurrencyFormat;
|
||||
use App\Enums\DateFormat;
|
||||
use App\Enums\IntervalFormat;
|
||||
use App\Enums\NumberFormat;
|
||||
use App\Enums\TimeFormat;
|
||||
use App\Models\Organization;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
@@ -27,6 +32,11 @@ class OrganizationFactory extends Factory
|
||||
'user_id' => User::factory(),
|
||||
'personal_team' => true,
|
||||
'employees_can_see_billable_rates' => false,
|
||||
'number_format' => $this->faker->randomElement(NumberFormat::values()),
|
||||
'currency_format' => $this->faker->randomElement(CurrencyFormat::values()),
|
||||
'date_format' => $this->faker->randomElement(DateFormat::values()),
|
||||
'interval_format' => $this->faker->randomElement(IntervalFormat::values()),
|
||||
'time_format' => $this->faker->randomElement(TimeFormat::values()),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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('organizations', function (Blueprint $table): void {
|
||||
$table->string('number_format')->default(config('app.localization.default_number_format'))->nullable(false);
|
||||
$table->string('currency_format')->default(config('app.localization.default_currency_format'))->nullable(false);
|
||||
$table->string('date_format')->default(config('app.localization.default_date_format'))->nullable(false);
|
||||
$table->string('interval_format')->default(config('app.localization.default_interval_format'))->nullable(false);
|
||||
$table->string('time_format')->default(config('app.localization.default_time_format'))->nullable(false);
|
||||
});
|
||||
|
||||
Schema::table('organizations', function (Blueprint $table): void {
|
||||
$table->string('number_format')->default(null)->nullable(false)->change();
|
||||
$table->string('currency_format')->default(null)->nullable(false)->change();
|
||||
$table->string('date_format')->default(null)->nullable(false)->change();
|
||||
$table->string('interval_format')->default(null)->nullable(false)->change();
|
||||
$table->string('time_format')->default(null)->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('organizations', function (Blueprint $table): void {
|
||||
$table->dropColumn('number_format');
|
||||
$table->dropColumn('currency_format');
|
||||
$table->dropColumn('date_format');
|
||||
$table->dropColumn('interval_format');
|
||||
$table->dropColumn('time_format');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user