CityModelFactory.php 730 B

1234567891011121314151617181920212223242526
  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\Provinces\Province;
  14. use App\Shop\Cities\City;
  15. $factory->define(City::class, function (Faker\Generator $faker) {
  16. $province = factory(Province::class)->create();
  17. return [
  18. 'name' => $faker->city,
  19. 'province_id' => $province->id
  20. ];
  21. });