JackD's avatar

negative number validation

i already tried numeric and integer for validation but how can i validate that the input field to accept only positive number?

thanks

max => required|integer;
min => required|integer;
0 likes
5 replies
toniperic's avatar
Level 30
$v = Validator::make($data, [
    'something' => 'integer|min:0'
]);
13 likes
JackD's avatar

thanks haven't think of that hahaha

sujiraj's avatar

$rules = [ 'something' => 'integer|min:0' ];

You can also use

{!! Form::number('number', 'mobile', ['min' =>0, 'id' => ....]) !!}

1 like

Please or to participate in this conversation.