Menu

## Validator
in package
implements ValidatorInterface

Validator.php : 28

### Interfaces, Classes and Traits

ValidatorInterface

### Table of Contents

$data : array<string|int, mixed>
$defaultRules : Collection
$errors : array<string|int, mixed>
$request : WebRequest
$rules : array<string|int, mixed>
$usesRequestData : bool
__construct() : mixed
addRule() : mixed
  Adds a ValidatorRule to use with the created Validator.
getErrors() : array<string|int, mixed>
  Returns all the errors in a multidimensional array with each error nested under the data field's name.
hasErrors() : bool
validate() : mixed
  Validates a field's value using the provided ValidatorRule's map name.
addError() : mixed
createRulesObjectFromString() : object
expandDotSyntaxArrayKeys() : array<string|int, mixed>
sendErrorResponse() : mixed

### Properties

#### $data

Validator.php : 35
`protected array<string|int, mixed> $data = []`

#### $defaultRules

Validator.php : 39
`protected Collection $defaultRules`

#### $errors

Validator.php : 37
`protected array<string|int, mixed> $errors = []`

#### $request

Validator.php : 31
`protected WebRequest $request`

#### $rules

Validator.php : 33
`protected array<string|int, mixed> $rules = []`

#### $usesRequestData

Validator.php : 41
`protected bool $usesRequestData = true`

### Methods

#### __construct()

Validator.php : 45
`public __construct([array<string|int, mixed> $rules = [] ][, array<string|int, mixed> $data = [] ][, bool $sendErrorResponses = true ]) : mixed`

##### Parameters

$rules : array<string|int, mixed> = []
$data : array<string|int, mixed> = []
$sendErrorResponses : bool = true

##### Return values

mixed —

#### addRule()

Validator.php : 249

Adds a ValidatorRule to use with the created Validator.

`public addRule(string $identifier, mixed $rule) : mixed`

##### Parameters

$identifier : string

  The "map name" or name to reference this rule by.

$rule : mixed

  The ValidatorRule's namespace (FQPN).

##### Return values

mixed —

#### getErrors()

Validator.php : 244

Returns all the errors in a multidimensional array with each error nested under the data field's name.

`public getErrors() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### hasErrors()

Validator.php : 233
`public hasErrors() : bool`

##### Return values

bool —

#### validate()

Validator.php : 85

Validates a field's value using the provided ValidatorRule's map name.

`public validate([array<string|int, mixed> $data = [] ][, bool $sendErrorResponses = false ]) : mixed`

##### Parameters

$data : array<string|int, mixed> = []
$sendErrorResponses : bool = false

##### Return values

mixed —

#### addError()

Validator.php : 259
`protected addError(string $key, string $error) : mixed`

##### Parameters

$key : string
$error : string

##### Return values

mixed —

#### createRulesObjectFromString()

Validator.php : 299
`private createRulesObjectFromString(string $rulesString) : object`

##### Parameters

$rulesString : string

##### Return values

object —

#### expandDotSyntaxArrayKeys()

Validator.php : 278
`private expandDotSyntaxArrayKeys(array<string|int, mixed> $arr) : array<string|int, mixed>`

##### Parameters

$arr : array<string|int, mixed>

##### Tags

todo

##### Return values

array<string|int, mixed> —

#### sendErrorResponse()

Validator.php : 264
`private sendErrorResponse() : mixed`

##### Return values

mixed —

## Search results