trait Illuminate / Support / Traits / Conditionable

Conditionable

Methods

public

when ( $value , callable $callback , callable $default ) : $this|TWhenReturnType

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

  • $value callable|TWhenParameter|null
  • $callback callable|null
  • $default callable|null
public

unless ( $value , callable $callback , callable $default ) : $this|TUnlessReturnType

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

  • $value callable|TUnlessParameter|null
  • $callback callable|null
  • $default callable|null