* #20 - wip * #20 - wip * #20 - fix * #20 - wip * #20 - fix * #20 - fix
This commit is contained in:
@@ -7,7 +7,8 @@ namespace Database\Factories;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Toby\Domain\EmploymentForm;
|
||||
use Toby\Domain\Enums\EmploymentForm;
|
||||
use Toby\Domain\Enums\Role;
|
||||
use Toby\Eloquent\Models\User;
|
||||
|
||||
class UserFactory extends Factory
|
||||
@@ -21,6 +22,7 @@ class UserFactory extends Factory
|
||||
"last_name" => $this->faker->lastName(),
|
||||
"email" => $this->faker->unique()->safeEmail(),
|
||||
"employment_form" => $this->faker->randomElement(EmploymentForm::cases()),
|
||||
"role" => Role::EMPLOYEE,
|
||||
"employment_date" => Carbon::createFromInterface($this->faker->dateTimeBetween("2020-10-27"))->toDateString(),
|
||||
"remember_token" => Str::random(10),
|
||||
];
|
||||
|
32
database/factories/VacationRequestFactory.php
Normal file
32
database/factories/VacationRequestFactory.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Toby\Domain\Enums\VacationRequestState;
|
||||
use Toby\Domain\Enums\VacationType;
|
||||
use Toby\Eloquent\Models\User;
|
||||
use Toby\Eloquent\Models\VacationRequest;
|
||||
|
||||
class VacationRequestFactory extends Factory
|
||||
{
|
||||
protected $model = VacationRequest::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$number = $this->faker->numberBetween(1, 20);
|
||||
$year = $this->faker->year;
|
||||
|
||||
return [
|
||||
"user_id" => User::factory(),
|
||||
"name" => "{$number}/{$year}",
|
||||
"type" => $this->faker->randomElement(VacationType::cases()),
|
||||
"state" => $this->faker->randomElement(VacationRequestState::cases()),
|
||||
"from" => $this->faker->date,
|
||||
"to" => $this->faker->date,
|
||||
"comment" => $this->faker->boolean ? $this->faker->paragraph() : null,
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user