* google calendar improvements * fix * change vacation request name * #85 - google calendar improvements * #85 - fix * #85 - fix * #85 - fix
This commit is contained in:
@@ -15,7 +15,6 @@ use Toby\Eloquent\Models\YearPeriod;
|
||||
class VacationRequestFactory extends Factory
|
||||
{
|
||||
protected $model = VacationRequest::class;
|
||||
private static int $number = 1;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
@@ -26,7 +25,6 @@ class VacationRequestFactory extends Factory
|
||||
"user_id" => User::factory(),
|
||||
"creator_id" => fn(array $attributes): int => $attributes["user_id"],
|
||||
"year_period_id" => YearPeriod::factory(),
|
||||
"name" => fn(array $attributes): string => $this->generateName($attributes),
|
||||
"type" => $this->faker->randomElement(VacationType::cases()),
|
||||
"state" => $this->faker->randomElement(VacationRequestStatesRetriever::all()),
|
||||
"from" => $from,
|
||||
@@ -34,12 +32,4 @@ class VacationRequestFactory extends Factory
|
||||
"comment" => $this->faker->boolean ? $this->faker->paragraph() : null,
|
||||
];
|
||||
}
|
||||
|
||||
protected function generateName(array $attributes): string
|
||||
{
|
||||
$year = YearPeriod::find($attributes["year_period_id"])->year;
|
||||
$number = static::$number++;
|
||||
|
||||
return "{$number}/{$year}";
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
<?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 {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table("vacations", function (Blueprint $table): void {
|
||||
$table->dropColumn("event_id");
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table("vacations", function (Blueprint $table): void {
|
||||
$table->string("event_id")->nullable();
|
||||
});
|
||||
}
|
||||
};
|
@@ -0,0 +1,25 @@
|
||||
<?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 {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table("vacation_requests", function (Blueprint $table): void {
|
||||
$table->json("event_ids")->nullable();
|
||||
$table->dropColumn("name");
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table("vacation_requests", function (Blueprint $table): void {
|
||||
$table->dropColumn("event_ids");
|
||||
$table->string("name")->nullable();
|
||||
});
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user