34 lines
935 B
PHP
34 lines
935 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\SalaryAdjustmentType;
|
|
use App\Models\Payroll;
|
|
use App\Models\PayrollAdjustment;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<PayrollAdjustment>
|
|
*/
|
|
class PayrollAdjustmentFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$type = fake()->randomElement(SalaryAdjustmentType::cases());
|
|
|
|
return [
|
|
'payroll_id' => Payroll::factory(),
|
|
'type' => $type,
|
|
'description' => $type === SalaryAdjustmentType::BONUS
|
|
? fake()->randomElement(['Lembur', 'Bonus Target', 'Bonus Tahunan', 'Tunjangan Transport'])
|
|
: fake()->randomElement(['Keterlambatan', 'Kasbon', 'BPJS', 'Pajak']),
|
|
'amount' => fake()->numberBetween(10000, 200000),
|
|
];
|
|
}
|
|
}
|