addProvider(new \Faker\Provider\fr_FR\Address($faker)); $faker->addProvider(new \Faker\Provider\fr_FR\PhoneNumber($faker)); $countries = Country::toArray(); $country = $countries[\array_rand($countries)]; $phone = $faker->phoneNumber; try { Validator::validate(['phone' => $phone], ['phone' => 'string|phone:FR,BE,LU']); } catch (ValidationException $e) { $phone = '0388982532'; } return [ 'firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'birth_date' => $faker->dateTimeBetween('-60 years', '-18 years'), 'address' => $faker->address, 'address2' => '', 'phone' => $phone, 'country' => $country->value, 'city' => $faker->city, 'postcode' => $faker->postcode, 'opt_in' => $faker->boolean, 'hashcode' => $faker->sha1 ]; } }