min max laravel validation code example
Example 1: numbric validate laravel
$rules = ['Fno' => 'numeric|min:2|max:5', 'Lno' => 'numeric|min:2'];
Example 2: laravel validate integer between
'item' => 'required|integer|between:1,10',
Example 3: laravel validation example
use Illuminate\Support\Facades\Validator;
$validator = Validator::make(['data' => $value],
['data' => 'string|min:1|max:10']
);
if ($validator->fails()) {
}
$validator = Validator::make(['data' => $array],
['email' => 'string|min:1|max:10'],
['username' => 'string|min:1|max:10'],
['password' => 'string|min:1|max:10'],
['...' => '...']
);
if ($validator->fails()) {
}