faker->numberBetween(3000000, 8000000); $bonus = $this->faker->numberBetween(0, 2000000); $deduction = $this->faker->numberBetween(0, 500000); return [ 'user_id' => User::factory(), 'period_month' => $this->faker->date('Y-m'), 'base_salary' => $base, 'bonus' => $bonus, 'deduction' => $deduction, 'total_salary' => $base + $bonus - $deduction, 'is_paid' => IsPaid::NOT_PAID, ]; } public function withPaidAt(?DateTime $paidAt = null): Factory { return $this->state(fn () => [ 'is_paid' => IsPaid::PAID, 'paid_at' => $paidAt ?? now(), ]); } public function withPeriodMonth(string $periodMonth): Factory { return $this->state(fn () => ['period_month' => $periodMonth]); } public function paid(): Factory { return $this->state(fn () => [ 'is_paid' => IsPaid::PAID, 'paid_at' => $this->faker->dateTimeBetween('-3 days', 'now'), ]); } public function notPaid(): Factory { return $this->state(fn () => [ 'is_paid' => IsPaid::NOT_PAID, 'paid_at' => null, ]); } }