Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

syntaxerron's avatar

Laravel Validation lte:field not working

I have two fields needed for validation: 'amount' and 'reimbursable_amount'.

The 'amount' field must be greater than zero. The 'reimbursable_amount' field must be less than or equal to 'amount' field and zero as the minimum value.

Both validations work, but the 'lte:amount' validation only works on negative values.

ExpenseStoreRequest.php :

public function rules()
    {
        return [
            'amount' => ['required', 'numeric', 'gt:0'],
            'reimbursable_amount' => ['required', 'numeric', 'min:0', 'lte:amount'],
		];
	}
0 likes
5 replies
CorvS's avatar

@erron What exactly do you mean by

...but the 'lte:amount' validation only works on negative values.

Can you give an example? What do your input fields look like?

1 like
MichalOravec's avatar
Level 75

gt validation rule compares value with another field, in your case zero which doesn't exist.

Use min:0.01 or min:1 instead.

public function rules()
{
    return [
        'amount' => ['required', 'numeric', 'min:0.01'],
        'reimbursable_amount' => ['required', 'numeric', 'min:0', 'lte:amount'],
    ];
}
1 like
syntaxerron's avatar

Thank you for the help, gt validation rule actually works on both value and field name.

aleksandrov_l's avatar

Can you try this:

public function rules()
    {
        return [
            'reimbursable_amount' => ['required', 'numeric', 'min:0', 'lte:amount'],
            'amount' => ['required', 'numeric', 'gt:0'],
		];
	}
1 like

Please or to participate in this conversation.