ldc-crm/database/factories/CustomerInfoFactory.php

46 lines
1.3 KiB
PHP
Raw Normal View History

2021-03-14 10:45:42 +01:00
<?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)];
2021-03-14 10:45:42 +01:00
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,
2021-03-14 10:45:42 +01:00
'city' => $this->faker->city,
'postcode' => $this->faker->postcode,
'opt_in' => $this->faker->boolean,
'hashcode' => $this->faker->sha1
];
}
}