ldc-com-app-bo/database/factories/UserFactory.php

43 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2023-03-14 14:57:03 +01:00
<?php
namespace Database\Factories;
2025-05-20 16:20:23 +02:00
use App\Models\Tenant;
2023-03-14 14:57:03 +01:00
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
2025-05-20 16:20:23 +02:00
public function definition(): array
2023-03-14 14:57:03 +01:00
{
return [
2025-05-20 16:20:23 +02:00
'firstname' => $this->faker->firstname(),
'lastname' => $this->faker->lastname(),
'email' => $this->faker->unique()->safeEmail(),
2023-03-14 14:57:03 +01:00
'email_verified_at' => now(),
2025-05-20 16:20:23 +02:00
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
'remember_token' => Str::random(10),
'tenant_id' => Tenant::query()->first('id'),
2023-03-14 14:57:03 +01:00
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
2025-05-20 16:20:23 +02:00
public function unverified(): \Illuminate\Database\Eloquent\Factories\Factory
2023-03-14 14:57:03 +01:00
{
return $this->state(function () {
return [
'email_verified_at' => null,
];
});
}
}