* 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}";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user