trait Fallback

Constants

protected SHOULD_FALLBACK_CONTEXT_KEY

Context key for the fallback condition.

protected FALLBACKS_CONTEXT_KEY

Context key for the fallback implementations.

Properties

static protected bool $shouldFallback

Whether to fallback to a custom implementation.

static protected array<class-string, Closure(static): mixed> $fallbacks

The fallback implementations.

Methods

static void
fallbackWhen(bool $condition)

Enable the fallback implementation.

static bool
shouldFallback()

Whether the prompt should fallback to a custom implementation.

static void
fallbackUsing(Closure $fallback)

Set the fallback implementation.

mixed
fallback()

Call the registered fallback implementation.

static void
resetFallback()

Reset fallback state to defaults.

Details

at line 39
static void fallbackWhen(bool $condition)

Enable the fallback implementation.

Parameters

bool $condition

Return Value

void

at line 52
static bool shouldFallback()

Whether the prompt should fallback to a custom implementation.

Return Value

bool

at line 69
static void fallbackUsing(Closure $fallback)

Set the fallback implementation.

Parameters

Closure $fallback

Return Value

void

at line 83
mixed fallback()

Call the registered fallback implementation.

Return Value

mixed

at line 107
static void resetFallback()

Reset fallback state to defaults.

Boot or tests only. Clears worker-wide prompt fallback configuration; concurrent prompts may render with different fallback behavior depending on timing.

Return Value

void