* 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:
@@ -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