dstpabuaran.com/app/Http/Requests/Admin/Finance/PayrollAdjustmentRequest.php

46 lines
1.1 KiB
PHP

<?php
namespace App\Http\Requests\Admin\Finance;
use App\Concerns\CurrencyStripping;
use App\Enums\PayrollAdjustmentType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Override;
class PayrollAdjustmentRequest extends FormRequest
{
use CurrencyStripping;
public function authorize(): bool
{
return true;
}
#[Override]
public function prepareForValidation(): void
{
$this->merge($this->stripCurrencyDot($this->all(), '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',
];
}
}