HasCasts
trait HasCasts
Constants
| private PRIMITIVE_CAST_TYPES |
The built-in request cast types. |
Methods
Get the casts for the validated request input.
Cast the validated request input.
Cast one input through a primitive or enum declaration.
Cast one input through a primitive declaration.
Ensure the decimal cast has a valid scale.
Resolve a custom request caster.
Decode the given float.
Return a decimal as a string.
Decode the given JSON value as an object.
Return a date with its time set to the start of the day.
Return a date-time instance.
Details
at line 58
protected array
casts()
Get the casts for the validated request input.
at line 69
protected array
castValidatedInput(array $input)
Cast the validated request input.
at line 345
protected mixed
castNativeInput(string $castType, string|null $primitiveCastType, string|null $argumentString, mixed $value)
Cast one input through a primitive or enum declaration.
at line 373
protected mixed
castPrimitiveInput(string $castType, string|null $argumentString, mixed $value)
Cast one input through a primitive declaration.
at line 395
protected void
ensureValidDecimalScale(string|null $scale, string $input)
Ensure the decimal cast has a valid scale.
at line 409
protected CastsRequestInput
resolveRequestCaster(string $castType, array $arguments, string $input)
Resolve a custom request caster.
at line 427
protected float
fromFloat(mixed $value)
Decode the given float.
at line 444
protected string
asDecimal(mixed $value, int $decimals)
Return a decimal as a string.
at line 456
protected object
asObject(mixed $value)
Decode the given JSON value as an object.
at line 471
protected CarbonInterface
asDate(mixed $value, string|null $format = null)
Return a date with its time set to the start of the day.
at line 479
protected CarbonInterface
asDateTime(mixed $value, string|null $format = null)
Return a date-time instance.