CommandInput
class CommandInput (View source)
Traits
Properties
| protected array | $arguments | The command arguments. |
|
| protected array | $options | The command options. |
Methods
Get all of the input for the command.
Retrieve data from the instance.
Determine if the instance contains any of the given keys.
Apply the callback if the instance contains the given key.
Determine if the instance contains a non-empty value for the given key.
Determine if the instance contains an empty value for the given key.
Determine if the instance contains a non-empty value for any of the given keys.
Apply the callback if the instance contains a non-empty value for the given key.
Apply the callback if the instance contains a valid enum value for the given key.
Determine if the instance is missing a given key.
Apply the callback if the instance is missing the given key.
Determine if the given key is an empty string for "filled".
Retrieve data from the instance as a Stringable instance.
Retrieve data from the instance as a Stringable instance.
Retrieve data as a boolean value.
Retrieve data as an integer value.
Retrieve data as a float value.
Retrieve data clamped between min and max values.
Retrieve data from the instance as a Carbon instance.
Retrieve data from the instance as a CarbonInterval instance.
Retrieve data from the instance as an enum.
Retrieve data from the instance as an array of enums.
Determine if the given enum class is backed.
Retrieve data from the instance as an array.
Retrieve data from the instance as a collection.
Get a subset containing the provided keys with values from the instance data.
Get all of the data except for a specified array of items.
Create a new command input container.
Get all of the arguments passed to the command.
Get all of the options passed to the command.
Get the instance as an array.
Dynamically access input data.
Determine if an input item is set.
Details
never
dd(mixed ...$args)
Dump the given arguments and terminate execution.
$this
dump(mixed ...$args)
Dump the given arguments.
array
all(mixed $keys = null)
Get all of the input for the command.
Options take precedence over arguments when keys collide.
protected mixed
data(string|null $key = null, mixed $default = null)
Retrieve data from the instance.
bool
exists(string|array $key)
Determine if the data contains a given key.
bool
has(string|array $key)
Determine if the data contains a given key.
bool
hasAny(string|array $keys)
Determine if the instance contains any of the given keys.
$this|TReturn|TReturnDefault
whenHas(string $key, callable $callback, callable|null $default = null)
Apply the callback if the instance contains the given key.
bool
filled(string|array $key)
Determine if the instance contains a non-empty value for the given key.
bool
isNotFilled(string|array $key)
Determine if the instance contains an empty value for the given key.
bool
anyFilled(string|array $keys)
Determine if the instance contains a non-empty value for any of the given keys.
$this|TReturn|TReturnDefault
whenFilled(string $key, callable $callback, callable|null $default = null)
Apply the callback if the instance contains a non-empty value for the given key.
$this|TReturn|TReturnDefault
whenEnum(string $key, string $enumClass, callable $callback, callable|null $default = null)
Apply the callback if the instance contains a valid enum value for the given key.
bool
missing(string|array $key)
Determine if the instance is missing a given key.
$this|TReturn|TReturnDefault
whenMissing(string $key, callable $callback, callable|null $default = null)
Apply the callback if the instance is missing the given key.
protected bool
isEmptyString(string $key)
Determine if the given key is an empty string for "filled".
Stringable
str(string $key, mixed $default = null)
Retrieve data from the instance as a Stringable instance.
Stringable
string(string $key, mixed $default = null)
Retrieve data from the instance as a Stringable instance.
bool
boolean(string|null $key = null, bool $default = false)
Retrieve data as a boolean value.
Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false.
int
integer(string $key, int $default = 0)
Retrieve data as an integer value.
float
float(string $key, float $default = 0.0)
Retrieve data as a float value.
float|int
clamp(string $key, int|float $min, int|float $max, int|float $default = 0)
Retrieve data clamped between min and max values.
Carbon|null
date(string $key, string|null $format = null, UnitEnum|string|null $tz = null)
Retrieve data from the instance as a Carbon instance.
CarbonInterval|null
interval(string $key, Unit|string|null $unit = null)
Retrieve data from the instance as a CarbonInterval instance.
TEnum|TDefault
enum(string $key, TEnum> $enumClass, TDefault $default = null)
Retrieve data from the instance as an enum.
TEnum[]
enums(string $key, TEnum> $enumClass)
Retrieve data from the instance as an array of enums.
protected bool
isBackedEnum(class-string $enumClass)
Determine if the given enum class is backed.
array
array(array|string|null $key = null)
Retrieve data from the instance as an array.
Collection
collect(array|string|null $key = null)
Retrieve data from the instance as a collection.
array
only(mixed $keys)
Get a subset containing the provided keys with values from the instance data.
array
except(mixed $keys)
Get all of the data except for a specified array of items.
__construct(array $arguments = [], array $options = [])
Create a new command input container.
array
arguments()
Get all of the arguments passed to the command.
array
options()
Get all of the options passed to the command.
array
toArray()
Get the instance as an array.
mixed
__get(string $name)
Dynamically access input data.
bool
__isset(string $name)
Determine if an input item is set.
Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.