2023-11-23 17:31:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
|
|
use App\Enums\Users\RoleEnum;
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
|
|
|
|
class UserFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array<string, mixed>
|
|
|
|
|
*/
|
|
|
|
|
public function definition()
|
|
|
|
|
{
|
|
|
|
|
$published = $this->faker->boolean(75);
|
|
|
|
|
return [
|
2025-07-25 17:21:23 +02:00
|
|
|
'first_name' => fake()->firstname(),
|
|
|
|
|
'last_name' => fake()->lastname(),
|
|
|
|
|
'email' => fake()->unique()->safeEmail(),
|
|
|
|
|
'remember_token' => Str::random(10),
|
|
|
|
|
'role' => \collect(RoleEnum::toArray())->random()->value,
|
|
|
|
|
'published' => $published,
|
|
|
|
|
'published_at' => ($published) ? now() : null,
|
2023-11-23 17:31:28 +01:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|