
# Conflicts: # app/Architecture/Providers/ObserverServiceProvider.php # app/Domain/Role.php # app/Domain/Rules/ApprovedVacationDaysInSameRange.php # app/Domain/Rules/DoesNotExceedLimitRule.php # app/Domain/Rules/MinimumOneVacationDayRule.php # app/Domain/Rules/PendingVacationRequestInSameRange.php # app/Domain/Rules/UsedVacationDaysInSameRange.php # app/Domain/Rules/VacationRequestRule.php # app/Domain/VacationRequestState.php # app/Domain/VacationRequestStateManager.php # app/Domain/VacationRequestValidator.php # app/Domain/VacationType.php # app/Domain/VacationTypeConfigRetriever.php # app/Eloquent/Models/User.php # app/Infrastructure/Http/Controllers/UserController.php # app/Infrastructure/Http/Kernel.php # app/Infrastructure/Http/Requests/UserRequest.php # database/factories/UserFactory.php # database/seeders/DatabaseSeeder.php # routes/web.php # tests/Feature/UserTest.php
31 lines
893 B
PHP
31 lines
893 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Carbon;
|
|
use Illuminate\Support\Str;
|
|
use Toby\Domain\Enums\EmploymentForm;
|
|
use Toby\Domain\Enums\Role;
|
|
use Toby\Eloquent\Models\User;
|
|
|
|
class UserFactory extends Factory
|
|
{
|
|
protected $model = User::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
"first_name" => $this->faker->firstName(),
|
|
"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),
|
|
];
|
|
}
|
|
}
|