52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
/**
|
|
* @extends Factory<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);
|
|
}
|
|
}
|