jeudi 26 mai 2016

Laravel set multiple message for max validation?

I am working on shopping cart and I have three prices like

price
shipping_price
sale_price

so I create a validation on price like

$result['validateRules']['sale_price'] = 'required|numeric|max:'.$value['price'].'|max:'.$value['selling_price'].'|min:1';

and the validation message is

$result['validateMessage']['sale_price.max'] = 'The Sale price must be smaller then '.$value['price'].' or '.$value['selling_price'];

it's working fine if i entered value like

price = 1500
selling_price = 1200
sale_price = 1600

then the validation fire like

The Sale price must be smaller than 1500 and 1600

but now i want to display message like

The Sale price must be smaller than 1500
The Sale price must be smaller than 1600

Now entered price like

price = 1500
selling_price = 1100
sale_price = 1200

then the validation fire like

The Sale price must be smaller than 1500 or 1100

instead of I want to set the message like

The Sale price must be smaller than 1100

how can I set message like this please help

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire