35 lines
948 B
PHP
35 lines
948 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Finance;
|
|
|
|
use App\Enums\SalaryAdjustmentType;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class SalaryAdjustmentRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'adjustments' => ['nullable', 'array'],
|
|
'adjustments.*.amount' => ['required', 'integer', 'min:0'],
|
|
'adjustments.*.type' => ['required', 'string', Rule::in(SalaryAdjustmentType::cases())],
|
|
'adjustments.*.description' => ['required', 'string', 'max:100'],
|
|
];
|
|
}
|
|
}
|