trait InteractsWithInput

Traits

Methods

never
dd(mixed ...$args)

Dump the given arguments and terminate execution.

from  Dumpable
dump(mixed $keys = [])

Dump the items.

array
all(mixed $keys = null)

Get all of the input and files for the request.

mixed
data(string|null $key = null, mixed $default = null)

Retrieve data from the instance.

bool
exists(array|string $key)

Determine if the data contains a given key.

bool
has(array|string $key)

Determine if the data contains a given key.

bool
hasAny(array|string $keys)

Determine if the instance contains any of the given keys.

mixed
whenHas(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains the given key.

bool
filled(array|string $key)

Determine if the instance contains a non-empty value for the given key.

bool
isNotFilled(array|string $key)

Determine if the instance contains an empty value for the given key.

bool
anyFilled(array|string $keys)

Determine if the instance contains a non-empty value for any of the given keys.

mixed
whenFilled(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a non-empty value for the given key.

mixed
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(array|string $key)

Determine if the instance is missing a given key.

mixed
whenMissing(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance is missing the given key.

bool
isEmptyString(string $key)

Determine if the given key is an empty string for "filled".

str(string $key, mixed $default = null)

Retrieve data from the instance as a Stringable instance.

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.

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.

int|float
clamp(string $key, int|float $min, int|float $max, int|float $default = 0)

Retrieve data clamped between min and max values.

CarbonInterface|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.

mixed
enum(string $key, string $enumClass, mixed $default = null)

Retrieve data from the instance as an enum.

array
enums(string $key, string $enumClass)

Retrieve data from the instance as an array of enums.

array
array(array|string|null $key = null)

Retrieve data from the instance as an array.

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.

string|array|int|float|null
server(string|null $key = null, string|array|int|float|null $default = null)

Retrieve a server variable from the request.

bool
hasHeader(string $key)

Determine if a header is set on the request.

string|array|null
header(string|null $key = null, string|array|null $default = null)

Retrieve a header from the request.

string|null
bearerToken()

Get the bearer token from the request headers.

array
keys()

Get the keys for all of the input and files.

mixed
input(string|null $key = null, mixed $default = null)

Retrieve an input item from the request.

fluent(array|string|null $key = null, array $default = [])

Retrieve input from the request as a Fluent object instance.

string|array|null
query(string|null $key = null, string|array|null $default = null)

Retrieve a query string item from the request.

string|array|null
post(string|null $key = null, string|array|null $default = null)

Retrieve a request payload item from the request.

bool
hasCookie(string $key)

Determine if a cookie is set on the request.

string|array|null
cookie(string|null $key = null, string|array|null $default = null)

Retrieve a cookie from the request.

array
allFiles()

Get an array of all of the files on the request.

array
convertUploadedFiles(array $files)

Convert the given array of Symfony UploadedFiles to custom Hypervel UploadedFiles.

bool
hasFile(string $key)

Determine if the uploaded data contains a file.

bool
isValidFile(mixed $file)

Check that the given file is a valid file instance.

UploadedFile|array|null
file(string|null $key = null, mixed $default = null)

Retrieve a file from the request.

Image|null
image(string $key)

Retrieve a file from the request as an image instance.

string|array|int|float|null
retrieveItem(string $source, string|null $key, string|array|int|float|null $default)

Retrieve a parameter item from a given source.

Details

in Dumpable at line 12
never dd(mixed ...$args)

Dump the given arguments and terminate execution.

Parameters

mixed ...$args

Return Value

never

at line 257
InteractsWithInput dump(mixed $keys = [])

Dump the items.

Parameters

mixed $keys

Return Value

InteractsWithInput

at line 75
array all(mixed $keys = null)

Get all of the input and files for the request.

Parameters

mixed $keys

Return Value

array

at line 233
protected mixed data(string|null $key = null, mixed $default = null)

Retrieve data from the instance.

Parameters

string|null $key
mixed $default

Return Value

mixed

in InteractsWithData at line 39
bool exists(array|string $key)

Determine if the data contains a given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 47
bool has(array|string $key)

Determine if the data contains a given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 66
bool hasAny(array|string $keys)

Determine if the instance contains any of the given keys.

Parameters

array|string $keys

Return Value

bool

in InteractsWithData at line 85
mixed whenHas(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains the given key.

Parameters

string $key
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 101
bool filled(array|string $key)

Determine if the instance contains a non-empty value for the given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 118
bool isNotFilled(array|string $key)

Determine if the instance contains an empty value for the given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 135
bool anyFilled(array|string $keys)

Determine if the instance contains a non-empty value for any of the given keys.

Parameters

array|string $keys

Return Value

bool

in InteractsWithData at line 159
mixed whenFilled(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance contains a non-empty value for the given key.

Parameters

string $key
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 184
mixed 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.

Parameters

string $key
string $enumClass
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 200
bool missing(array|string $key)

Determine if the instance is missing a given key.

Parameters

array|string $key

Return Value

bool

in InteractsWithData at line 217
mixed whenMissing(string $key, callable $callback, callable|null $default = null)

Apply the callback if the instance is missing the given key.

Parameters

string $key
callable $callback
callable|null $default

Return Value

mixed

in InteractsWithData at line 233
protected bool isEmptyString(string $key)

Determine if the given key is an empty string for "filled".

Parameters

string $key

Return Value

bool

in InteractsWithData at line 245
Stringable str(string $key, mixed $default = null)

Retrieve data from the instance as a Stringable instance.

Parameters

string $key
mixed $default

Return Value

Stringable

in InteractsWithData at line 253
Stringable string(string $key, mixed $default = null)

Retrieve data from the instance as a Stringable instance.

Parameters

string $key
mixed $default

Return Value

Stringable

in InteractsWithData at line 263
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.

Parameters

string|null $key
bool $default

Return Value

bool

in InteractsWithData at line 271
int integer(string $key, int $default = 0)

Retrieve data as an integer value.

Parameters

string $key
int $default

Return Value

int

in InteractsWithData at line 279
float float(string $key, float $default = 0.0)

Retrieve data as a float value.

Parameters

string $key
float $default

Return Value

float

in InteractsWithData at line 287
int|float clamp(string $key, int|float $min, int|float $max, int|float $default = 0)

Retrieve data clamped between min and max values.

Parameters

string $key
int|float $min
int|float $max
int|float $default

Return Value

int|float

in InteractsWithData at line 305
CarbonInterface|null date(string $key, string|null $format = null, UnitEnum|string|null $tz = null)

Retrieve data from the instance as a Carbon instance.

Parameters

string $key
string|null $format
UnitEnum|string|null $tz

Return Value

CarbonInterface|null

Exceptions

InvalidFormatException

in InteractsWithData at line 323
CarbonInterval|null interval(string $key, Unit|string|null $unit = null)

Retrieve data from the instance as a CarbonInterval instance.

Parameters

string $key
Unit|string|null $unit

Return Value

CarbonInterval|null

in InteractsWithData at line 350
mixed enum(string $key, string $enumClass, mixed $default = null)

Retrieve data from the instance as an enum.

Parameters

string $key
string $enumClass
mixed $default

Return Value

mixed

in InteractsWithData at line 367
array enums(string $key, string $enumClass)

Retrieve data from the instance as an array of enums.

Parameters

string $key
string $enumClass

Return Value

array

in InteractsWithData at line 382
array array(array|string|null $key = null)

Retrieve data from the instance as an array.

Parameters

array|string|null $key

Return Value

array

in InteractsWithData at line 390
Collection collect(array|string|null $key = null)

Retrieve data from the instance as a collection.

Parameters

array|string|null $key

Return Value

Collection

in InteractsWithData at line 398
array only(mixed $keys)

Get a subset containing the provided keys with values from the instance data.

Parameters

mixed $keys

Return Value

array

in InteractsWithData at line 420
array except(mixed $keys)

Get all of the data except for a specified array of items.

Parameters

mixed $keys

Return Value

array

at line 25
string|array|int|float|null server(string|null $key = null, string|array|int|float|null $default = null)

Retrieve a server variable from the request.

Parameters

string|null $key
string|array|int|float|null $default

Return Value

string|array|int|float|null

at line 33
bool hasHeader(string $key)

Determine if a header is set on the request.

Parameters

string $key

Return Value

bool

at line 41
string|array|null header(string|null $key = null, string|array|null $default = null)

Retrieve a header from the request.

Parameters

string|null $key
string|array|null $default

Return Value

string|array|null

at line 49
string|null bearerToken()

Get the bearer token from the request headers.

Return Value

string|null

at line 67
array keys()

Get the keys for all of the input and files.

Return Value

array

at line 97
mixed input(string|null $key = null, mixed $default = null)

Retrieve an input item from the request.

Parameters

string|null $key
mixed $default

Return Value

mixed

at line 109
Fluent fluent(array|string|null $key = null, array $default = [])

Retrieve input from the request as a Fluent object instance.

Parameters

array|string|null $key
array $default

Return Value

Fluent

at line 119
string|array|null query(string|null $key = null, string|array|null $default = null)

Retrieve a query string item from the request.

Parameters

string|null $key
string|array|null $default

Return Value

string|array|null

at line 127
string|array|null post(string|null $key = null, string|array|null $default = null)

Retrieve a request payload item from the request.

Parameters

string|null $key
string|array|null $default

Return Value

string|array|null

at line 135
bool hasCookie(string $key)

Determine if a cookie is set on the request.

Parameters

string $key

Return Value

bool

Retrieve a cookie from the request.

Parameters

string|null $key
string|array|null $default

Return Value

string|array|null

at line 153
array allFiles()

Get an array of all of the files on the request.

Return Value

array

at line 166
protected array convertUploadedFiles(array $files)

Convert the given array of Symfony UploadedFiles to custom Hypervel UploadedFiles.

Parameters

array $files

Return Value

array

at line 182
bool hasFile(string $key)

Determine if the uploaded data contains a file.

Parameters

string $key

Return Value

bool

at line 201
protected bool isValidFile(mixed $file)

Check that the given file is a valid file instance.

Parameters

mixed $file

Return Value

bool

at line 211
UploadedFile|array|null file(string|null $key = null, mixed $default = null)

Retrieve a file from the request.

Parameters

string|null $key
mixed $default

Return Value

UploadedFile|array|null

at line 219
Image|null image(string $key)

Retrieve a file from the request as an image instance.

Parameters

string $key

Return Value

Image|null

at line 241
protected string|array|int|float|null retrieveItem(string $source, string|null $key, string|array|int|float|null $default)

Retrieve a parameter item from a given source.

Parameters

string $source
string|null $key
string|array|int|float|null $default

Return Value

string|array|int|float|null