You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

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