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.

38 lines
928 B

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