ldc-crm/database/factories/CustomerInfoFactory.php
Jérémy Munsch 6131b1a171 - working testing env
- use php artisan serve to run test + autokill
- autodebug if envirronement is testing
2021-08-05 15:00:28 +02:00

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
];
}
}