Menu

## NumericRule extends ValidatorRule
in package

NumericRule.php : 14

Class NumericRule

Validates that the value provided for the specified field is numeric.

### Table of Contents

$field : string
  The property name on the data array.
$nestedLookup : bool
  Determines whether this method should drill down the array to validate other arrays and objects it finds.
$optional : bool
  Used to determine if the validator can pass if the field is null, empty, or not provided.
$ruleValue : mixed
  The property's value on the data array.
$usesRequestData : bool
  Convenience method to determine if the Rule is using the raw request data or data from another source.
__construct() : mixed
  ValidatorRule constructor.
getErrorMessage() : string
  Returns the error message string to show as feedback if the validator fails.
getRuleValue() : mixed
  Returns the rule's value to use for validation against the data value.
isValid() : bool
  Returns true if the value passes the validator's checks.
stopOnError() : bool
  When this returns true, all other validators are not ran and the Validator returns this error and any other errors encountered before this rule.

### Properties

#### $field

ValidatorRule.php : 18

The property name on the data array.

`protected string $field`

#### $nestedLookup

ValidatorRule.php : 42

Determines whether this method should drill down the array to validate other arrays and objects it finds.

`protected bool $nestedLookup = false`

#### $optional

ValidatorRule.php : 30

Used to determine if the validator can pass if the field is null, empty, or not provided.

`protected bool $optional`

#### $ruleValue

ValidatorRule.php : 24

The property's value on the data array.

`protected mixed $ruleValue`

#### $usesRequestData

ValidatorRule.php : 36

Convenience method to determine if the Rule is using the raw request data or data from another source.

`protected bool $usesRequestData`

### Methods

#### __construct()

ValidatorRule.php : 52

ValidatorRule constructor.

`public __construct( $field, $ruleValue, $usesRequestData[, false $optional = false ]) : mixed`

##### Parameters

$field :
$ruleValue :
$usesRequestData :
$optional : false = false

##### Return values

mixed —

#### getErrorMessage()

NumericRule.php : 34

Returns the error message string to show as feedback if the validator fails.

`public getErrorMessage() : string`

##### Return values

string —

#### getRuleValue()

ValidatorRule.php : 96

Returns the rule's value to use for validation against the data value.

`public getRuleValue() : mixed`

For example, if MinRule is used `min:6`, this method would return 6.

##### Return values

mixed —

#### isValid()

NumericRule.php : 17

Returns true if the value passes the validator's checks.

`public isValid(mixed $dataArray) : bool`

##### Parameters

$dataArray : mixed

##### Return values

bool —

#### stopOnError()

ValidatorRule.php : 85

When this returns true, all other validators are not ran and the Validator returns this error and any other errors encountered before this rule.

`public stopOnError() : bool`

##### Return values

bool —

## Search results