mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 12:10:41 -05:00
57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Facades\Hash;
|
|
use Illuminate\Support\Str;
|
|
use Random\RandomException;
|
|
|
|
/**
|
|
* @extends Factory<User>
|
|
*/
|
|
class UserFactory extends Factory
|
|
{
|
|
/**
|
|
* The current password being used by the factory.
|
|
*/
|
|
protected static ?string $password;
|
|
|
|
protected $model = User::class;
|
|
|
|
/**
|
|
* Define the user's default state.
|
|
*
|
|
* @throws RandomException
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => fake()->userName(),
|
|
'email' => fake()->unique()->safeEmail(),
|
|
'email_verified_at' => now(),
|
|
'password' => static::$password ??= Hash::make('password'),
|
|
|
|
// TODO: Does Faker have a markdown plugin?
|
|
'about' => fake()->paragraphs(random_int(1, 10), true),
|
|
|
|
'two_factor_secret' => null,
|
|
'two_factor_recovery_codes' => null,
|
|
'remember_token' => Str::random(10),
|
|
'user_role_id' => null,
|
|
'profile_photo_path' => null,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Indicate that the user's email address should be unverified.
|
|
*/
|
|
public function unverified(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'email_verified_at' => null,
|
|
]);
|
|
}
|
|
}
|