<?php

namespace App\Http\Requests\Payroll;

use Illuminate\Foundation\Http\FormRequest;

class UpdateAdvanceRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'user_id' => 'required | max:191',
            'date' => 'required',
            'advance_type' => 'required',
            'amount' => 'required',
            'recovery_mode' => 'required',
            'recovery_cycle' => 'required',
            'recover_from' => 'nullable',
            'reason' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'user_id.required' => _trans('validation.UserId is required'),
            'date.required' => _trans('validation.Date is required'),
            'advance_type.required' => _trans('validation.AdvanceType is required'),
            'amount.required' => _trans('validation.Amount is required'),
            'recovery_mode.required' => _trans('validation.RecoveryMode is required'),
            'recovery_cycle.required' => _trans('validation.RecoveryCycle is required'),
            'reason.required' => _trans('validation.Reason is required'),
        ];
    }
}
