30 lines
853 B
PHP
30 lines
853 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
use Uwil\LaravelBackend\Enums\RoleEnum;
|
|
|
|
class UserFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$published = fake()->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,
|
|
'last_connection' => now(),
|
|
];
|
|
}
|
|
}
|