MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/snap.cafsinfotech.in/database/factories/TimeIntervalFactory.php
<?php

namespace Database\Factories;

use App\Helpers\FakeScreenshotGenerator;
use App\Models\TimeInterval;
use Illuminate\Database\Eloquent\Factories\Factory;

class TimeIntervalFactory extends Factory
{
    protected $model = TimeInterval::class;

    public function definition(): array
    {
        return [
            'is_manual' => false,
            'start_at' => now()->subMinutes(5)->toDateTimeString(),
            'end_at' => now()->toDateTimeString(),
            'mouse_fill' => fake()->numberBetween(0, 100),
            'keyboard_fill' => fake()->numberBetween(0, 100),
            'activity_fill' => static fn(array $attributes) =>
                +$attributes['keyboard_fill'] + $attributes['mouse_fill'],
        ];
    }

    public function withScreenshot(): TimeIntervalFactory
    {
        return $this->afterCreating(function (TimeInterval $timeInterval) {
            FakeScreenshotGenerator::runForTimeInterval($timeInterval);
        });
    }
}