Files
econom/database/factories/ReportPeriodFactory.php
brusnitsyn fb2e6c58e3
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
first commit
2026-04-06 00:06:00 +09:00

42 lines
897 B
PHP

<?php
namespace Database\Factories;
use App\Enums\ReportPeriodStatus;
use App\Models\ReportPeriod;
use App\Models\Team;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<ReportPeriod>
*/
class ReportPeriodFactory extends Factory
{
protected $model = ReportPeriod::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'team_id' => Team::factory(),
'year' => 2026,
'month' => fake()->numberBetween(1, 12),
'status' => ReportPeriodStatus::Draft,
];
}
/**
* Indicate that the period is approved.
*/
public function approved(): static
{
return $this->state(fn (array $attributes) => [
'status' => ReportPeriodStatus::Approved,
]);
}
}