UsersFactory.php 932 B

12345678910111213141516171819202122232425262728293031323334353637
  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\model\Users>
  7. */
  8. class UsersFactory 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' => uniqid() . mt_rand(1,100),
  19. 'email' => uniqid() . mt_rand(1,100) . '@example.com',
  20. 'email_verified_at' => time(),
  21. 'password' => uniqid() . mt_rand(1,100),
  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. }