class Illuminate / Validation / ConditionalRules

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