class Illuminate / Validation / ConditionalRules
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

ConditionalRules

Properties

protected

$condition callable|bool

The boolean condition indicating if the rules should be added to the attribute.

Default: null
protected

$rules array|string|Closure

The rules to be added to the attribute.

Default: null
protected

$defaultRules array|string|Closure

The rules to be added to the attribute if the condition fails.

Default: null

Methods

public

__construct ( $condition , $rules , $defaultRules ) : void

Create a new conditional rules instance.

Parameters

  • $condition callable|bool
  • $rules array|string|Closure
  • $defaultRules array|string|Closure
public

passes ( array $data ) : bool

Determine if the conditional rules should be added.

Parameters

  • $data array
public

rules ( array $data ) : array

Get the rules.

Parameters

  • $data array
public

defaultRules ( array $data ) : array

Get the default rules.

Parameters

  • $data array