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