2024-08-01 13:53:10 -05:00
|
|
|
<?php
|
|
|
|
|
|
2025-01-28 17:33:54 -06:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2024-08-01 13:53:10 -05:00
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
|
|
|
|
*/
|
|
|
|
|
class UserFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The current password being used by the factory.
|
|
|
|
|
*/
|
|
|
|
|
protected static ?string $password;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array<string, mixed>
|
|
|
|
|
*/
|
|
|
|
|
public function definition(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'name' => fake()->name(),
|
|
|
|
|
'email' => fake()->unique()->safeEmail(),
|
|
|
|
|
'email_verified_at' => now(),
|
|
|
|
|
'password' => static::$password ??= Hash::make('password'),
|
|
|
|
|
'two_factor_secret' => null,
|
|
|
|
|
'two_factor_recovery_codes' => null,
|
|
|
|
|
'remember_token' => Str::random(10),
|
2025-01-28 17:14:49 -06:00
|
|
|
'profile_photo_path' => null,
|
2025-04-09 19:25:15 -05:00
|
|
|
'options' => [
|
|
|
|
|
'display_currency' => 'USD',
|
|
|
|
|
'locale' => 'en',
|
|
|
|
|
],
|
2024-08-01 13:53:10 -05:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicate that the model's email address should be unverified.
|
|
|
|
|
*/
|
|
|
|
|
public function unverified(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'email_verified_at' => null,
|
|
|
|
|
]);
|
|
|
|
|
}
|
2025-04-09 19:25:15 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicate that the model's currency.
|
|
|
|
|
*/
|
|
|
|
|
public function currency($currency): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => array_merge($attributes['options'], [
|
|
|
|
|
'currency' => $currency,
|
|
|
|
|
]));
|
|
|
|
|
}
|
2024-08-01 13:53:10 -05:00
|
|
|
}
|