Files
Website/database/factories/UserFactory.php
2024-04-22 18:16:33 +10:00

53 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
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'firstname' => fake()->firstName(),
'surname' => fake()->lastName(),
'phone' => fake()->phoneNumber(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'remember_token' => Str::random(10),
'home_address' => fake()->streetAddress(),
'home_city' => fake()->city(),
'home_state' => '',
'home_postcode' => fake()->postcode(),
'home_country' => fake()->country(),
'billing_address' => fake()->streetAddress(),
'billing_city' => fake()->city(),
'billing_state' => '',
'billing_postcode' => fake()->postcode(),
'billing_country' => fake()->country(),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}