dstpabuaran.com/app/Http/Requests/Admin/Finance/PayrollAdjustmentRequest.php
Yoga Pangestu 6dbe9da581 feat: add payroll management features including payroll periods, adjustments, and payment processing
- Implemented routes for managing payroll periods, including current, close, and reopen functionalities.
- Added payroll payment and cancellation routes.
- Introduced payroll adjustments with store and delete functionalities.
- Created comprehensive feature tests for payroll management, covering authentication, CRUD operations, and business logic.
- Ensured proper handling of payroll adjustments and their impact on payroll totals.
- Developed tests for generating payrolls and managing payroll periods, ensuring accurate status transitions and data integrity.
2026-07-30 17:06:52 +07:00

47 lines
1.1 KiB
PHP

<?php
namespace App\Http\Requests\Admin\Finance;
use App\Enums\PayrollAdjustmentType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Override;
class PayrollAdjustmentRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
#[Override]
public function prepareForValidation()
{
if ($this->has('amount')) {
$this->merge([
'amount' => str_replace('.', '', $this->amount),
]);
}
}
public function rules(): array
{
return [
'type' => ['required', Rule::in(PayrollAdjustmentType::values())],
'amount' => ['required', 'integer', 'min:1'],
'description' => ['required', 'string', 'max:100'],
'attendance_id' => ['nullable', 'integer', 'exists:attendances,id'],
];
}
public function attributes(): array
{
return [
'type' => 'jenis',
'amount' => 'jumlah',
'description' => 'keterangan',
'attendance_id' => 'presensi',
];
}
}