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.
 
 
 
 

39 lines
1.1 KiB

<?php
namespace Database\Factories\Documents;
use App\Documents\FingerPrintDocument;
use App\Documents\UserDocument;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Jenssegers\Agent\Agent;
class FingerPrintDocumentFactory extends Factory
{
protected $model = FingerPrintDocument::class;
public function definition()
{
$browsers = [
$this->faker->firefox,
$this->faker->chrome,
$this->faker->opera,
$this->faker->safari,
];
$detector = new Agent();
return [
'_id' => app('nextId'),
'user_id' => '',
'token' => Str::random(60),
'agent' => app()->environment("testing")? 'Firefox': $detector->browser(Arr::random($browsers)),
'os' => app()->environment("testing")? 'Ubuntu': $detector->platform(Arr::random($browsers)),
'ip' => $this->faker->ipv4,
'city' => "Tehran",
'country' => "Iran",
'expires_at' => $this->faker->dateTimeBetween('+1 day', ' +6 month')->format('Y-m-d'),
];
}
}