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