first commit

This commit is contained in:
Saufi
2026-06-24 20:32:14 +08:00
commit 10fb30ad69
201 changed files with 21356 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use App\Models\ReportingCycle;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\Factory;
class ReportingCycleFactory extends Factory
{
protected $model = ReportingCycle::class;
public function definition(): array
{
$renewalYear = fake()->numberBetween(2026, 2035);
$reportingYear = $renewalYear - 2;
return [
'renewal_year' => $renewalYear,
'reporting_year' => $reportingYear,
'period_start' => Carbon::create($reportingYear, 1, 1),
'period_end' => Carbon::create($reportingYear, 12, 31),
'cut_off_date' => Carbon::create($renewalYear - 1, 12, 1),
'licence_period_year' => 1,
'status' => 'aktif',
];
}
public function renewalYear(int $year): static
{
return $this->state(fn () => [
'renewal_year' => $year,
'reporting_year' => $year - 2,
'period_start' => Carbon::create($year - 2, 1, 1),
'period_end' => Carbon::create($year - 2, 12, 31),
'cut_off_date' => Carbon::create($year - 1, 12, 1),
]);
}
public function overdue(): static
{
return $this->state(fn () => ['cut_off_date' => now()->subDays(5)]);
}
}