UserFactory.php 912 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /** @var \Illuminate\Database\Eloquent\Factory $factory */
  3. use App\User;
  4. use Illuminate\Support\Str;
  5. use Faker\Generator as Faker;
  6. /*
  7. |--------------------------------------------------------------------------
  8. | Model Factories
  9. |--------------------------------------------------------------------------
  10. |
  11. | This directory should contain each of the model factory definitions for
  12. | your application. Factories provide a convenient way to generate new
  13. | model instances for testing / seeding your application's database.
  14. |
  15. */
  16. $factory->define(User::class, function (Faker $faker) {
  17. return [
  18. 'name' => $faker->name,
  19. 'email' => $faker->unique()->safeEmail,
  20. 'email_verified_at' => now(),
  21. 'password' => '$2y$10$vvcID/Akq2KjOZwRUUgBJOpVyGi.nTDT8Yb7gxiy5Xj9/5GnpzBMi', // password
  22. 'api_token' => $faker->md5,
  23. 'remember_token' => Str::random(10),
  24. ];
  25. });