Laravel max Validator not working

laravel, laravel-4, php

Solution

You have `schoolSeatsTotal` as a string. For string data, max value corresponds to the number of characters. You want to validate an integer instead.

So change

$input = ["schoolSeatsTotal" => '2000'];

to

$input = ["schoolSeatsTotal" => 2000];

To make sure you are validating numbers - do this:

$rules = ['schoolSeatsTotal'=>'numeric|max:300'];

Problem

I'm new to Laravel. Could someone explain why `max` validator doesn't work as I expected in this case? ``` $input = ["schoolSeatsTotal" => '2000']; $rules = ['schoolSeatsTotal'=>'max:300']; $validator = Validator::make($input, $rules); $validator->fails(); //Expected: true, Actual: false. ```

Original source