Support the ongoing development of Laravel.io →
posted 10 years ago
Validation

Hi,

I have the following rules:

$rules = array(
        'purchase_amount' => 'required|integer',
        'payment_amount' => 'required|integer',
);

I need to add a rule that states that the value of 'payment_amount' will never be greater than the value of 'purchase_amount'. It is perfectly valid for them to be equal or that 'payment_amount' will be less than 'purchase_amount'.

How can I achieve that?

Thanks in advance

Last updated 3 years ago.
0

Create custom validation rule.

Use this tutorial as reference.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

nirsharony nirsharony Joined 23 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.