2020-01-10 10:51:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
|
|
|
|
|
|
|
|
|
use Faker\Generator as Faker;
|
|
|
|
|
use Webkul\Customer\Models\Customer;
|
2020-06-09 07:45:44 +00:00
|
|
|
use Illuminate\Support\Arr;
|
2020-01-10 10:51:03 +00:00
|
|
|
use Webkul\Customer\Models\CustomerAddress;
|
|
|
|
|
|
|
|
|
|
$factory->define(CustomerAddress::class, function (Faker $faker) {
|
2020-01-22 09:38:35 +00:00
|
|
|
// use an locale from a country in europe so the vat id can be generated
|
2020-01-24 14:26:33 +00:00
|
|
|
$fakerIt = \Faker\Factory::create('it_IT');
|
2020-01-22 09:38:35 +00:00
|
|
|
|
2020-01-10 10:51:03 +00:00
|
|
|
return [
|
2020-01-10 10:59:53 +00:00
|
|
|
'customer_id' => function () {
|
2020-01-10 10:51:03 +00:00
|
|
|
return factory(Customer::class)->create()->id;
|
|
|
|
|
},
|
2020-01-10 10:59:53 +00:00
|
|
|
'company_name' => $faker->company,
|
2020-01-27 10:31:46 +00:00
|
|
|
'vat_id' => $fakerIt->vatId(),
|
2020-01-28 06:02:26 +00:00
|
|
|
'first_name' => $faker->firstName,
|
|
|
|
|
'last_name' => $faker->lastName,
|
2020-01-10 10:59:53 +00:00
|
|
|
'address1' => $faker->streetAddress,
|
|
|
|
|
'country' => $faker->countryCode,
|
|
|
|
|
'state' => $faker->state,
|
|
|
|
|
'city' => $faker->city,
|
|
|
|
|
'postcode' => $faker->postcode,
|
|
|
|
|
'phone' => $faker->e164PhoneNumber,
|
2020-06-09 07:35:48 +00:00
|
|
|
'default_address' => Arr::random([0, 1]),
|
2020-04-17 09:09:59 +00:00
|
|
|
'address_type' => CustomerAddress::ADDRESS_TYPE,
|
2020-01-10 10:51:03 +00:00
|
|
|
];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|