Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel validation : difference between numeric and integer?

Tags:

in laravel docs there seems to be an integer and a numeric validation rule. i was wondering what the difference between the both was?

like image 884
bazi Avatar asked Nov 05 '16 04:11

bazi


People also ask

How many types of validation are there in laravel?

Each form request generated by Laravel has two methods: authorize and rules .

How does validation work in laravel?

The validate method accepts an incoming HTTP request and a set of validation rules. If the validation rules pass, your code will keep executing normally; however, if validation fails, an exception will be thrown and the proper error response will automatically be sent back to the user.

How does laravel validate country code?

Usage. Validate a 2 character country code. use LVR\CountryCode\Two; $request->validate([ 'country' => ['required', new Two], ]);

What is confirmed in laravel validation?

confirmed. The field under validation must have a matching field of foo_confirmation . For example, if the field under validation is password , a matching password_confirmation field must be present in the input.


1 Answers

Integer is like a whole number without fraction: 2, 256, 2048.

http://php.net/manual/en/function.is-int.php

Numeric is any number including floating point numbers: 2.478, +0123.45e6

http://php.net/manual/en/function.is-numeric.php

like image 123
Alexey Mezenin Avatar answered Oct 01 '22 18:10

Alexey Mezenin