* change layout * change layout * #22 - wip * wip * wip * #22 - wip * #22 - wip * #22 - wip * #22 - wip * #22 - fix * #22 - wip * #22 - added some tests * #22 - wip * #22 - wip * #22 - fix * #22 - wip * #22 - wip * #22 - wip * #22 - fix * #22 - fix * #22 - fix * #22 - fix * #22 - fix * #22 - fix * #22 - cr fixes * #22 - cr fix Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
@@ -23,7 +23,7 @@ class UserFactory extends Factory
|
||||
"email" => $this->faker->unique()->safeEmail(),
|
||||
"employment_form" => $this->faker->randomElement(EmploymentForm::cases()),
|
||||
"position" => $this->faker->jobTitle(),
|
||||
"role" => Role::EMPLOYEE,
|
||||
"role" => Role::Employee,
|
||||
"employment_date" => Carbon::createFromInterface($this->faker->dateTimeBetween("2020-10-27"))->toDateString(),
|
||||
"remember_token" => Str::random(10),
|
||||
];
|
||||
|
15
database/factories/VacationFactory.php
Normal file
15
database/factories/VacationFactory.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class VacationFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\CarbonImmutable;
|
||||
use Carbon\CarbonPeriod;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Toby\Domain\Enums\VacationRequestState;
|
||||
use Toby\Domain\Enums\VacationType;
|
||||
@@ -31,7 +30,6 @@ class VacationRequestFactory extends Factory
|
||||
"state" => $this->faker->randomElement(VacationRequestState::cases()),
|
||||
"from" => $from,
|
||||
"to" => $from->addDays($days),
|
||||
"estimated_days" => fn(array $attributes) => $this->estimateDays($attributes),
|
||||
"comment" => $this->faker->boolean ? $this->faker->paragraph() : null,
|
||||
];
|
||||
}
|
||||
@@ -43,11 +41,4 @@ class VacationRequestFactory extends Factory
|
||||
|
||||
return "{$number}/{$year}";
|
||||
}
|
||||
|
||||
protected function estimateDays(array $attributes): int
|
||||
{
|
||||
$period = CarbonPeriod::create($attributes["from"], $attributes["to"]);
|
||||
|
||||
return $period->count();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user