UserFactory.php 729 B

12345678910111213141516171819202122232425
  1. <?php
  2. use Faker\Generator as Faker;
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Model Factories
  6. |--------------------------------------------------------------------------
  7. |
  8. | This directory should contain each of the model factory definitions for
  9. | your application. Factories provide a convenient way to generate new
  10. | model instances for testing / seeding your application's database.
  11. |
  12. */
  13. $factory->define(App\User::class, function (Faker $faker) {
  14. static $password;
  15. return [
  16. 'name' => $faker->name,
  17. 'email' => $faker->unique()->safeEmail,
  18. 'password' => $password ?: $password = bcrypt('secret'),
  19. 'remember_token' => str_random(10),
  20. ];
  21. });