Laravel min and max validation control panel size

I just need to verify that Laravel validates that the array contains a minimum of 2 values ​​and a maximum of 4 values. Can this rule be used for default authentication? Element sizechecks the exact size and other rules like minand maxfor strings, numbers, and file size.

+4
source share
1 answer

You can use between. , https://laravel.com/docs/5.2/validation#rule-between

For instance:

'users' => 'required|array|between:2,4'

The docs are not explicitly stated in the docs, but it works with arrays, just like size.

+12
source

Source: https://habr.com/ru/post/1670283/


All Articles