AddressModelFactory.php 960 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Model Factories
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here you may define all of your model factories. Model factories give
  8. | you a convenient way to create models for testing and seeding your
  9. | database. Just tell the factory how a default model should look.
  10. |
  11. */
  12. /** @var \Illuminate\Database\Eloquent\Factory $factory */
  13. use App\Shop\Addresses\Address;
  14. use App\Shop\Customers\Customer;
  15. $factory->define(Address::class, function (Faker\Generator $faker) {
  16. $customer = factory(Customer::class)->create();
  17. return [
  18. 'alias' => $faker->word,
  19. 'address_1' => $faker->streetAddress,
  20. 'address_2' => null,
  21. 'zip' => $faker->postcode,
  22. 'city' => $faker->city,
  23. 'province_id' => 1,
  24. 'country_id' => 1,
  25. 'customer_id' => $customer->id,
  26. 'status' => 1
  27. ];
  28. });