trait Conditionable (View source)

Methods

$this|mixed
when(mixed $value, callable $callback, callable|null $default = null)

Apply the callback if the given "value" is truthy.

$this|mixed
unless(mixed $value, callable $callback, callable|null $default = null)

Apply the callback if the given "value" is falsy.

Details

$this|mixed when(mixed $value, callable $callback, callable|null $default = null)

Apply the callback if the given "value" is truthy.

Parameters

mixed $value
callable $callback
callable|null $default

Return Value

$this|mixed

$this|mixed unless(mixed $value, callable $callback, callable|null $default = null)

Apply the callback if the given "value" is falsy.

Parameters

mixed $value
callable $callback
callable|null $default

Return Value

$this|mixed