text4u
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

UserFactory.php 956B

1234567891011121314151617181920212223242526272829303132333435363738
  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(): array
  16. {
  17. return [
  18. 'name' => fake()->name(),
  19. 'email' => fake()->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. public function unverified(): static
  29. {
  30. return $this->state(fn (array $attributes) => [
  31. 'email_verified_at' => null,
  32. ]);
  33. }
  34. }