UserFactory.php 1.0 KB

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