Files
alrahma_sunday_school_api/database/factories/UserFactory.php
T
2026-06-09 01:03:53 -04:00

52 lines
1.4 KiB
PHP

<?php
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 [
'school_id' => fake()->numberBetween(1, 5),
'firstname' => fake()->firstName(),
'lastname' => fake()->lastName(),
'gender' => fake()->randomElement(['Male', 'Female']),
'cellphone' => fake()->numerify('##########'),
'email' => fake()->unique()->safeEmail(),
'address_street' => fake()->streetAddress(),
'city' => fake()->city(),
'state' => fake()->stateAbbr(),
'zip' => fake()->postcode(),
'accept_school_policy' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
'password' => static::$password ??= Hash::make('password'),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => $attributes);
}
}