faker->numberBetween(3000000, 8000000); $bonus = $this->faker->numberBetween(0, 2000000); $deduction = $this->faker->numberBetween(0, 500000); $isPaid = $this->faker->randomElement(IsPaid::cases()); 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, 'paid_at' => $isPaid === IsPaid::PAID ? $this->faker->dateTimeBetween('-3 days', 'now') : null, ]; } 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, ]); } }