29 lines
838 B
PHP
29 lines
838 B
PHP
<?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(): array
|
|
{
|
|
$published = $this->faker->boolean(75);
|
|
return [
|
|
'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,
|
|
];
|
|
}
|
|
}
|