ldc-crm/database/factories/UserFactory.php

31 lines
920 B
PHP
Raw Permalink Normal View History

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