2023-03-31 15:24:32 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
|
|
use App\Enums\AppUserRolesEnum;
|
|
|
|
|
use App\Models\AppUser;
|
2025-05-20 16:20:23 +02:00
|
|
|
use App\Models\Tenant;
|
2023-03-31 15:24:32 +02:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @extends Factory<\App\Models\AppUser>
|
|
|
|
|
*/
|
|
|
|
|
class AppUserFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $model = AppUser::class;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
2025-05-20 16:20:23 +02:00
|
|
|
public function definition(): array
|
2023-03-31 15:24:32 +02:00
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'firstname' => $this->faker->unique()->firstname(),
|
2025-05-20 16:20:23 +02:00
|
|
|
'lastname' => $this->faker->unique()->lastName(),
|
|
|
|
|
'email' => $this->faker->unique()->safeEmail(),
|
|
|
|
|
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
|
|
|
|
|
'status' => $this->faker->boolean(75),
|
2025-05-26 11:35:18 +02:00
|
|
|
'role' => collect(AppUserRolesEnum::cases())->random(),
|
2025-05-20 16:20:23 +02:00
|
|
|
'tenant_id' => Tenant::query()->first('id'),
|
2023-03-31 15:24:32 +02:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|