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.

37 lines
893 B

  1. <?php
  2. /** @var Factory $factory */
  3. use App\Models\Fingerprint;
  4. use Faker\Factory as Faker;
  5. use Illuminate\Support\Arr;
  6. use Illuminate\Support\Str;
  7. $faker = Faker::create('fa_IR');
  8. $factory->define(Fingerprint::class, function () use ($faker) {
  9. $os = [
  10. $faker->windowsPlatformToken,
  11. $faker->linuxPlatformToken,
  12. $faker->macPlatformToken
  13. ];
  14. $browsers = [
  15. $faker->firefox,
  16. $faker->chrome,
  17. $faker->opera,
  18. $faker->safari,
  19. ];
  20. $detector = new Jenssegers\Agent\Agent();
  21. return [
  22. 'user_id' => $faker->numberBetween(1, 1000),
  23. 'agent' => $detector->browser(Arr::random($browsers)),
  24. 'ip' => $faker->ipv4,
  25. 'os' => $detector->platform(Arr::random($browsers)),
  26. 'latitude' => $faker->latitude,
  27. 'longitude' => $faker->longitude,
  28. 'token' => Str::random(60),
  29. ];
  30. });