php - Laravel max Validator not working -
i'm new laravel.
could explain why max validator doesn't work expected in case?
$input = ["schoolseatstotal" => '2000']; $rules = ['schoolseatstotal'=>'max:300']; $validator = validator::make($input, $rules); $validator->fails(); //expected: true, actual: false.
you have schoolseatstotal string. string data, max value corresponds number of characters. want validate integer instead.
so change
$input = ["schoolseatstotal" => '2000']; to
$input = ["schoolseatstotal" => 2000]; to make sure validating numbers - this:
$rules = ['schoolseatstotal'=>'numeric|max:300'];
Comments
Post a Comment