38 lines
929 B
PHP
38 lines
929 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Employee;
|
|
use App\Models\SickLeave;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<SickLeave>
|
|
*/
|
|
class SickLeaveFactory extends Factory
|
|
{
|
|
protected $model = SickLeave::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$startDate = fake()->dateTimeBetween('-3 months', 'now');
|
|
$days = fake()->numberBetween(1, 10);
|
|
$endDate = (clone $startDate)->modify("+{$days} days");
|
|
|
|
return [
|
|
'employee_id' => Employee::factory(),
|
|
'start_date' => $startDate,
|
|
'end_date' => $endDate,
|
|
'days' => $days,
|
|
'medical_institution' => fake()->optional()->company().' Hospital',
|
|
'reason' => fake()->optional()->sentence(),
|
|
'document_path' => null,
|
|
];
|
|
}
|
|
}
|