vendredi 8 novembre 2019

How to fix bug on validation 'min' Laravel 5.8

I am trying to validate an integer field using a FormRequest class extension. The validation works fine in most cases but i found an issue.

The rule is

'operation_id'      => 'required|integer|min:1'

It works with values like:

operation_id: 0  //false
operation_id: 0s //false
operation_id: -1 //false
operation_id: 1  //true

But It fails when setting value

operation_id: 0\n //It throws a true when it should be a false

I am using Laravel 5.8, and I am sending the data to test requests validation through Postman.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire