Laravel - Validation - Rule Size

The field under validation must have a size matching the given value. For string data, value corresponds to the number of characters. For numeric data, value corresponds to a given integer value (the attribute must also have the numeric or integer rule). For an array, size corresponds to the count of the array. For files, size corresponds to the file size in kilobytes. Let's look at some examples:

    
    // Validate that a string is exactly 12 characters long...
    'title' => 'size:12';
    
    // Validate that a provided integer equals 10...
    'seats' => 'integer|size:10';
    
    // Validate that an array has exactly 5 elements...
    'tags' => 'array|size:5';
    
    // Validate that an uploaded file is exactly 512 kilobytes...
    'image' => 'file|size:512';