2015-05-08 08:42:04 -05:00
|
|
|
<?php
|
|
|
|
|
2020-04-21 10:12:39 -05:00
|
|
|
namespace Database\Factories;
|
2019-12-31 12:21:39 +00:00
|
|
|
|
2020-04-21 10:12:39 -05:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
2023-10-25 01:11:07 +11:00
|
|
|
use Illuminate\Support\Facades\Hash;
|
2019-09-10 17:26:00 +02:00
|
|
|
use Illuminate\Support\Str;
|
2017-04-11 10:41:19 -05:00
|
|
|
|
2022-01-21 12:03:57 +00:00
|
|
|
/**
|
2022-01-21 12:32:08 +00:00
|
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
2022-01-21 12:03:57 +00:00
|
|
|
*/
|
2020-04-21 10:12:39 -05:00
|
|
|
class UserFactory extends Factory
|
|
|
|
{
|
2023-11-21 02:20:28 +11:00
|
|
|
/**
|
|
|
|
* The current password being used by the factory.
|
|
|
|
*/
|
2023-10-25 01:11:07 +11:00
|
|
|
protected static ?string $password;
|
|
|
|
|
2020-04-21 10:12:39 -05:00
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*
|
2022-02-09 21:24:35 +01:00
|
|
|
* @return array<string, mixed>
|
2020-04-21 10:12:39 -05:00
|
|
|
*/
|
2023-01-03 09:35:24 +00:00
|
|
|
public function definition(): array
|
2020-04-21 10:12:39 -05:00
|
|
|
{
|
|
|
|
return [
|
2022-06-22 11:02:43 -05:00
|
|
|
'name' => fake()->name(),
|
2022-09-02 22:10:54 +08:00
|
|
|
'email' => fake()->unique()->safeEmail(),
|
2020-04-21 10:12:39 -05:00
|
|
|
'email_verified_at' => now(),
|
2023-10-25 01:11:07 +11:00
|
|
|
'password' => static::$password ??= Hash::make('password'),
|
2020-04-21 10:12:39 -05:00
|
|
|
'remember_token' => Str::random(10),
|
|
|
|
];
|
|
|
|
}
|
2021-02-09 15:52:23 -05:00
|
|
|
|
|
|
|
/**
|
2021-02-16 10:58:28 -06:00
|
|
|
* Indicate that the model's email address should be unverified.
|
2021-02-09 15:52:23 -05:00
|
|
|
*/
|
2023-01-03 09:35:24 +00:00
|
|
|
public function unverified(): static
|
2021-02-09 15:52:23 -05:00
|
|
|
{
|
2022-08-20 12:22:43 -05:00
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
'email_verified_at' => null,
|
|
|
|
]);
|
2021-02-09 15:52:23 -05:00
|
|
|
}
|
2020-04-21 10:12:39 -05:00
|
|
|
}
|