45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\Country;
|
|
use App\Models\CustomerInfo;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class CustomerInfoFactory extends Factory
|
|
{
|
|
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = CustomerInfo::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition()
|
|
{
|
|
$this->faker->addProvider(new \Faker\Provider\fr_FR\Address($this->faker));
|
|
$this->faker->addProvider(new \Faker\Provider\fr_FR\PhoneNumber($this->faker));
|
|
$countries = Country::toArray();
|
|
$country = $countries[\array_rand($countries)];
|
|
return [
|
|
'firstname' => $this->faker->firstName,
|
|
'lastname' => $this->faker->lastName,
|
|
'birth_date' => $this->faker->dateTimeBetween('-60 years', '-18 years'),
|
|
'address' => $this->faker->address,
|
|
'address2' => '',
|
|
'phone' => $this->faker->phoneNumber,
|
|
'country' => $country,
|
|
'newcountry' => $country,
|
|
'city' => $this->faker->city,
|
|
'postcode' => $this->faker->postcode,
|
|
'opt_in' => $this->faker->boolean,
|
|
'hashcode' => $this->faker->sha1
|
|
];
|
|
}
|
|
}
|