@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?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
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'],
];
}
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'],
];
}
Please or to participate in this conversation.