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 59
protected array
casts()
Get the casts for the validated request input.
at line 70
protected array
castValidatedInput(array $input)
Cast the validated request input.
at line 346
protected mixed
castNativeInput(string $castType, string|null $primitiveCastType, string|null $argumentString, mixed $value)
Cast one input through a primitive or enum declaration.
at line 374
protected mixed
castPrimitiveInput(string $castType, string|null $argumentString, mixed $value)
Cast one input through a primitive declaration.
at line 396
protected void
ensureValidDecimalScale(string|null $scale, string $input)
Ensure the decimal cast has a valid scale.
at line 410
protected CastsRequestInput
resolveRequestCaster(string $castType, array $arguments, string $input)
Resolve a custom request caster.
at line 428
protected float
fromFloat(mixed $value)
Decode the given float.
at line 445
protected string
asDecimal(mixed $value, int $decimals)
Return a decimal as a string.
at line 465
protected object
asObject(mixed $value)
Decode the given JSON value as an object.
at line 480
protected CarbonInterface
asDate(mixed $value, string|null $format = null)
Return a date with its time set to the start of the day.
at line 488
protected CarbonInterface
asDateTime(mixed $value, string|null $format = null)
Return a date-time instance.