class Illuminate / Validation / ConditionalRules
You are viewing an older version of the documentation. For the latest, please visit master documentation.

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

The rules to be added to the attribute.

Default: null
protected

$defaultRules array|string

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
  • $defaultRules array|string
public

passes ( array $data ) : bool

Determine if the conditional rules should be added.

Parameters

  • $data array
public

rules ( ) : array

Get the rules.

public

defaultRules ( ) : array

Get the default rules.