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

<?php
/** @var Factory $factory */
use App\Fingerprint;
use Faker\Factory as Faker;
use Illuminate\Database\Eloquent\Factory;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
$faker = Faker::create('fa_IR');
$factory->define(Fingerprint::class, function () use ($faker) {
$os = [
$faker->windowsPlatformToken,
$faker->linuxPlatformToken,
$faker->macPlatformToken
];
$browsers = [
$faker->firefox,
$faker->chrome,
$faker->opera,
$faker->safari,
];
$detector = new Jenssegers\Agent\Agent();
return [
'user_id' => $faker->numberBetween(1, 1000),
'agent' => $detector->browser(Arr::random($browsers)),
'ip' => $faker->ipv4,
'os' => $detector->platform(Arr::random($browsers)),
'latitude' => $faker->latitude,
'longitude' => $faker->longitude,
'token' => Str::random(60),
];
});