base commit
This commit is contained in:
37
database/factories/SickLeaveFactory.php
Normal file
37
database/factories/SickLeaveFactory.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user