StateModelFactory.php 766 B

123456789101112131415161718192021222324252627
  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\Countries\Country;
  14. use App\Shop\States\State;
  15. $factory->define(State::class, function (Faker\Generator $faker) {
  16. $country = factory(Country::class)->create();
  17. return [
  18. 'state' => $faker->city,
  19. 'state_code' => $faker->word,
  20. 'country_id' => $country->id
  21. ];
  22. });