se modifica userfactory para entorno de producción

This commit is contained in:
2026-02-20 16:51:21 -06:00
parent 78916d9d99
commit 2533af98c8
+13 -9
View File
@@ -24,21 +24,25 @@ class UserFactory extends Factory
* *
* @return array<string, mixed> * @return array<string, mixed>
*/ */
public function definition(): array private static $fakerInstance;
public function definition(): array
{ {
if (!self::$fakerInstance) {
self::$fakerInstance = \Faker\Factory::create();
}
$faker = self::$fakerInstance;
return [ return [
'name' => $this->faker->name(), 'name' => $faker->name(),
'email' => $this->faker->unique()->safeEmail(), 'email' => $faker->unique()->safeEmail(),
'telefono' => $this->faker->phoneNumber(), 'telefono' => $faker->numerify('##########'),
'direccion' => $this->faker->address(), 'direccion' => $faker->address(),
'status' => 1, 'status' => 1,
'email_verified_at' => now(), 'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'), 'password' => static::$password ??= Hash::make('password'),
'two_factor_secret' => null,
'two_factor_recovery_codes' => null,
'remember_token' => Str::random(10), 'remember_token' => Str::random(10),
'profile_photo_path' => null,
'current_team_id' => null,
]; ];
} }