41 lines
946 B
PHP
41 lines
946 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Finance;
|
|
|
|
use App\Enums\PayrollAdjustmentType;
|
|
use App\Enums\Permission;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class PayrollAdjustmentRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()?->can(Permission::PAYROLL_ADJUST->value) ?? false;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'type' => ['required', Rule::enum(PayrollAdjustmentType::class)],
|
|
'amount' => ['required', 'integer', 'min:1'],
|
|
'description' => ['required', 'string', 'max:100'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'type' => 'jenis',
|
|
'amount' => 'jumlah',
|
|
'description' => 'keterangan',
|
|
];
|
|
}
|
|
}
|