ldc-web/database/factories/UserFactory.php

41 lines
1 KiB
PHP
Raw Normal View History

2022-09-21 11:17:58 +00:00
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
2023-09-22 09:59:11 +02:00
* @return array<string, mixed>
2022-09-21 11:17:58 +00:00
*/
public function definition()
{
return [
2023-09-22 09:59:11 +02:00
'firstname' => fake()->firstname(),
'lastname' => fake()->lastname(),
'email' => fake()->unique()->safeEmail(),
2022-09-21 11:17:58 +00:00
'email_verified_at' => now(),
// * password
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*
2023-09-22 09:59:11 +02:00
* @return static
2022-09-21 11:17:58 +00:00
*/
2023-09-22 09:59:11 +02:00
public function unverified(): static
2022-09-21 11:17:58 +00:00
{
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
2023-09-22 09:59:11 +02:00
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
2022-09-21 11:17:58 +00:00
}
}