UserFactory.php 965 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Database\Factories;
  3. use Illuminate\Database\Eloquent\Factories\Factory;
  4. use Illuminate\Support\Str;
  5. class UserFactory extends Factory
  6. {
  7. /**
  8. * Define the model's default state.
  9. *
  10. * @return array
  11. */
  12. public function definition()
  13. {
  14. return [
  15. 'name' => $this->faker->name(),
  16. 'email' => $this->faker->unique()->safeEmail(),
  17. 'email_verified_at' => now(),
  18. 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
  19. 'remember_token' => Str::random(10),
  20. ];
  21. }
  22. /**
  23. * Indicate that the model's email address should be unverified.
  24. *
  25. * @return \Illuminate\Database\Eloquent\Factories\Factory
  26. */
  27. public function unverified()
  28. {
  29. return $this->state(function (array $attributes) {
  30. return [
  31. 'email_verified_at' => null,
  32. ];
  33. });
  34. }
  35. }