ValidatesAttributes
Methods
validateAccepted ( $attribute , $value ) : bool
Validate that an attribute was "accepted".
Parameters
- $attribute string
- $value mixed
validateAcceptedIf ( $attribute , $value , $parameters ) : bool
Validate that an attribute was "accepted" when another attribute has a given value.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateDeclined ( $attribute , $value ) : bool
Validate that an attribute was "declined".
Parameters
- $attribute string
- $value mixed
validateDeclinedIf ( $attribute , $value , $parameters ) : bool
Validate that an attribute was "declined" when another attribute has a given value.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateActiveUrl ( $attribute , $value ) : bool
Validate that an attribute is an active URL.
Parameters
- $attribute string
- $value mixed
validateBail ( ) : bool
"Break" on first validation fail.
validateBefore ( $attribute , $value , $parameters ) : bool
Validate the date is before a given date.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateBeforeOrEqual ( $attribute , $value , $parameters ) : bool
Validate the date is before or equal a given date.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateAfter ( $attribute , $value , $parameters ) : bool
Validate the date is after a given date.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateAfterOrEqual ( $attribute , $value , $parameters ) : bool
Validate the date is equal or after a given date.
Parameters
- $attribute string
- $value mixed
- $parameters array
compareDates ( $attribute , $value , $parameters , $operator ) : bool
Compare a given date against another using an operator.
Parameters
- $attribute string
- $value mixed
- $parameters array
- $operator string
getDateFormat ( $attribute ) : string|null
Get the date format for an attribute if it has one.
Parameters
- $attribute string
getDateTimestamp ( $value ) : int
Get the date timestamp.
Parameters
- $value mixed
checkDateTimeOrder ( $format , $first , $second , $operator ) : bool
Given two date/time strings, check that one is after the other.
Parameters
- $format string
- $first string
- $second string
- $operator string
getDateTimeWithOptionalFormat ( $format , $value ) : DateTime |null
Get a DateTime instance from a string.
Parameters
- $format string
- $value string
getDateTime ( $value ) : DateTime |null
Get a DateTime instance from a string with no format.
Parameters
- $value string
validateAlpha ( $attribute , $value ) : bool
Validate that an attribute contains only alphabetic characters.
Parameters
- $attribute string
- $value mixed
validateAlphaDash ( $attribute , $value ) : bool
Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.
Parameters
- $attribute string
- $value mixed
validateAlphaNum ( $attribute , $value ) : bool
Validate that an attribute contains only alpha-numeric characters.
Parameters
- $attribute string
- $value mixed
validateArray ( $attribute , $value , $parameters ) : bool
Validate that an attribute is an array.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateRequiredArrayKeys ( $attribute , $value , $parameters ) : bool
Validate that an array has all of the given keys.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateBetween ( $attribute , $value , $parameters ) : bool
Validate the size of an attribute is between a set of values.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateBoolean ( $attribute , $value ) : bool
Validate that an attribute is a boolean.
Parameters
- $attribute string
- $value mixed
validateConfirmed ( $attribute , $value ) : bool
Validate that an attribute has a matching confirmation.
Parameters
- $attribute string
- $value mixed
validateCurrentPassword ( $attribute , $value , $parameters ) : bool
Validate that the password of the currently authenticated user matches the given value.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateDate ( $attribute , $value ) : bool
Validate that an attribute is a valid date.
Parameters
- $attribute string
- $value mixed
validateDateFormat ( $attribute , $value , $parameters ) : bool
Validate that an attribute matches a date format.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateDateEquals ( $attribute , $value , $parameters ) : bool
Validate that an attribute is equal to another date.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateDifferent ( $attribute , $value , $parameters ) : bool
Validate that an attribute is different from another attribute.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateDigits ( $attribute , $value , $parameters ) : bool
Validate that an attribute has a given number of digits.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateDigitsBetween ( $attribute , $value , $parameters ) : bool
Validate that an attribute is between a given number of digits.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateDimensions ( $attribute , $value , $parameters ) : bool
Validate the dimensions of an image matches the given values.
Parameters
- $attribute string
- $value mixed
- $parameters array
failsBasicDimensionChecks ( $parameters , $width , $height ) : bool
Test if the given width and height fail any conditions.
Parameters
- $parameters array
- $width int
- $height int
failsRatioCheck ( $parameters , $width , $height ) : bool
Determine if the given parameters fail a dimension ratio check.
Parameters
- $parameters array
- $width int
- $height int
validateDistinct ( $attribute , $value , $parameters ) : bool
Validate an attribute is unique among other values.
Parameters
- $attribute string
- $value mixed
- $parameters array
getDistinctValues ( $attribute ) : array
Get the values to distinct between.
Parameters
- $attribute string
extractDistinctValues ( $attribute ) : array
Extract the distinct values from the data.
Parameters
- $attribute string
validateEmail ( $attribute , $value , $parameters ) : bool
Validate that an attribute is a valid e-mail address.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateExists ( $attribute , $value , $parameters ) : bool
Validate the existence of an attribute value in a database table.
Parameters
- $attribute string
- $value mixed
- $parameters array
getExistCount ( $connection , $table , $column , $value , $parameters ) : int
Get the number of records that exist in storage.
Parameters
- $connection mixed
- $table string
- $column string
- $value mixed
- $parameters array
validateUnique ( $attribute , $value , $parameters ) : bool
Validate the uniqueness of an attribute value on a given database table.
Parameters
- $attribute string
- $value mixed
- $parameters array
getUniqueIds ( $idColumn , $parameters ) : array
Get the excluded ID column and value for the unique rule.
Parameters
- $idColumn string|null
- $parameters array
prepareUniqueId ( $id ) : int
Prepare the given ID for querying.
Parameters
- $id mixed
getUniqueExtra ( $parameters ) : array
Get the extra conditions for a unique rule.
Parameters
- $parameters array
parseTable ( $table ) : array
Parse the connection / table for the unique / exists rules.
Parameters
- $table string
getQueryColumn ( $parameters , $attribute ) : bool
Get the column name for an exists / unique query.
Parameters
- $parameters array
- $attribute string
guessColumnForQuery ( $attribute ) : string
Guess the database column from the given attribute name.
Parameters
- $attribute string
getExtraConditions ( array $segments ) : array
Get the extra conditions for a unique / exists rule.
Parameters
- $segments array
validateFile ( $attribute , $value ) : bool
Validate the given value is a valid file.
Parameters
- $attribute string
- $value mixed
validateFilled ( $attribute , $value ) : bool
Validate the given attribute is filled if it is present.
Parameters
- $attribute string
- $value mixed
validateGt ( $attribute , $value , $parameters ) : bool
Validate that an attribute is greater than another attribute.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateLt ( $attribute , $value , $parameters ) : bool
Validate that an attribute is less than another attribute.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateGte ( $attribute , $value , $parameters ) : bool
Validate that an attribute is greater than or equal another attribute.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateLte ( $attribute , $value , $parameters ) : bool
Validate that an attribute is less than or equal another attribute.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateImage ( $attribute , $value ) : bool
Validate the MIME type of a file is an image MIME type.
Parameters
- $attribute string
- $value mixed
validateIn ( $attribute , $value , $parameters ) : bool
Validate an attribute is contained within a list of values.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateInArray ( $attribute , $value , $parameters ) : bool
Validate that the values of an attribute are in another attribute.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateInteger ( $attribute , $value ) : bool
Validate that an attribute is an integer.
Parameters
- $attribute string
- $value mixed
validateIp ( $attribute , $value ) : bool
Validate that an attribute is a valid IP.
Parameters
- $attribute string
- $value mixed
validateIpv4 ( $attribute , $value ) : bool
Validate that an attribute is a valid IPv4.
Parameters
- $attribute string
- $value mixed
validateIpv6 ( $attribute , $value ) : bool
Validate that an attribute is a valid IPv6.
Parameters
- $attribute string
- $value mixed
validateMacAddress ( $attribute , $value ) : bool
Validate that an attribute is a valid MAC address.
Parameters
- $attribute string
- $value mixed
validateJson ( $attribute , $value ) : bool
Validate the attribute is a valid JSON string.
Parameters
- $attribute string
- $value mixed
validateMax ( $attribute , $value , $parameters ) : bool
Validate the size of an attribute is less than a maximum value.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateMimes ( $attribute , $value , $parameters ) : bool
Validate the guessed extension of a file upload is in a set of file extensions.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateMimetypes ( $attribute , $value , $parameters ) : bool
Validate the MIME type of a file upload attribute is in a set of MIME types.
Parameters
- $attribute string
- $value mixed
- $parameters array
shouldBlockPhpUpload ( $value , $parameters ) : bool
Check if PHP uploads are explicitly allowed.
Parameters
- $value mixed
- $parameters array
validateMin ( $attribute , $value , $parameters ) : bool
Validate the size of an attribute is greater than a minimum value.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateMultipleOf ( $attribute , $value , $parameters ) : bool
Validate the value of an attribute is a multiple of a given value.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateNullable ( ) : bool
"Indicate" validation should pass if value is null.
validateNotIn ( $attribute , $value , $parameters ) : bool
Validate an attribute is not contained within a list of values.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateNumeric ( $attribute , $value ) : bool
Validate that an attribute is numeric.
Parameters
- $attribute string
- $value mixed
validatePassword ( $attribute , $value , $parameters ) : bool
Validate that the password of the currently authenticated user matches the given value.
Parameters
- $attribute string
- $value mixed
- $parameters array
validatePresent ( $attribute , $value ) : bool
Validate that an attribute exists even if not filled.
Parameters
- $attribute string
- $value mixed
validateRegex ( $attribute , $value , $parameters ) : bool
Validate that an attribute passes a regular expression check.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateNotRegex ( $attribute , $value , $parameters ) : bool
Validate that an attribute does not pass a regular expression check.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateRequired ( $attribute , $value ) : bool
Validate that a required attribute exists.
Parameters
- $attribute string
- $value mixed
validateRequiredIf ( $attribute , $value , $parameters ) : bool
Validate that an attribute exists when another attribute has a given value.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateProhibited ( $attribute , $value ) : bool
Validate that an attribute does not exist.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateProhibitedIf ( $attribute , $value , $parameters ) : bool
Validate that an attribute does not exist when another attribute has a given value.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateProhibitedUnless ( $attribute , $value , $parameters ) : bool
Validate that an attribute does not exist unless another attribute has a given value.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateProhibits ( $attribute , $value , $parameters ) : bool
Validate that other attributes do not exist when this attribute exists.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateExclude ( ) : bool
Indicate that an attribute is excluded.
validateExcludeIf ( $attribute , $value , $parameters ) : bool
Indicate that an attribute should be excluded when another attribute has a given value.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateExcludeUnless ( $attribute , $value , $parameters ) : bool
Indicate that an attribute should be excluded when another attribute does not have a given value.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateRequiredUnless ( $attribute , $value , $parameters ) : bool
Validate that an attribute exists when another attribute does not have a given value.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateExcludeWithout ( $attribute , $value , $parameters ) : bool
Indicate that an attribute should be excluded when another attribute is missing.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
parseDependentRuleParameters ( $parameters ) : array
Prepare the values and the other value for validation.
Parameters
- $parameters array
shouldConvertToBoolean ( $parameter ) : bool
Check if parameter should be converted to boolean.
Parameters
- $parameter string
convertValuesToBoolean ( $values ) : array
Convert the given values to boolean if they are string "true" / "false".
Parameters
- $values array
convertValuesToNull ( $values ) : array
Convert the given values to null if they are string "null".
Parameters
- $values array
validateRequiredWith ( $attribute , $value , $parameters ) : bool
Validate that an attribute exists when any other attribute exists.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateRequiredWithAll ( $attribute , $value , $parameters ) : bool
Validate that an attribute exists when all other attributes exist.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateRequiredWithout ( $attribute , $value , $parameters ) : bool
Validate that an attribute exists when another attribute does not.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
validateRequiredWithoutAll ( $attribute , $value , $parameters ) : bool
Validate that an attribute exists when all other attributes do not.
Parameters
- $attribute string
- $value mixed
- $parameters mixed
anyFailingRequired ( array $attributes ) : bool
Determine if any of the given attributes fail the required test.
Parameters
- $attributes array
allFailingRequired ( array $attributes ) : bool
Determine if all of the given attributes fail the required test.
Parameters
- $attributes array
validateSame ( $attribute , $value , $parameters ) : bool
Validate that two attributes match.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateSize ( $attribute , $value , $parameters ) : bool
Validate the size of an attribute.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateSometimes ( ) : bool
"Validate" optional attributes.
validateStartsWith ( $attribute , $value , $parameters ) : bool
Validate the attribute starts with a given substring.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateEndsWith ( $attribute , $value , $parameters ) : bool
Validate the attribute ends with a given substring.
Parameters
- $attribute string
- $value mixed
- $parameters array
validateString ( $attribute , $value ) : bool
Validate that an attribute is a string.
Parameters
- $attribute string
- $value mixed
validateTimezone ( $attribute , $value ) : bool
Validate that an attribute is a valid timezone.
Parameters
- $attribute string
- $value mixed
validateUrl ( $attribute , $value ) : bool
Validate that an attribute is a valid URL.
Parameters
- $attribute string
- $value mixed
validateUuid ( $attribute , $value ) : bool
Validate that an attribute is a valid UUID.
Parameters
- $attribute string
- $value mixed
getSize ( $attribute , $value ) : mixed
Get the size of an attribute.
Parameters
- $attribute string
- $value mixed
isValidFileInstance ( $value ) : bool
Check that the given value is a valid file instance.
Parameters
- $value mixed
compare ( $first , $second , $operator ) : bool
Determine if a comparison passes between the given values.
Parameters
- $first mixed
- $second mixed
- $operator string
parseNamedParameters ( $parameters ) : array
Parse named parameters to $key => $value items.
Parameters
- $parameters array
requireParameterCount ( $count , $parameters , $rule ) : void
Require a certain number of parameters to be present.
Parameters
- $count int
- $parameters array
- $rule string
isSameType ( $first , $second ) : bool
Check if the parameters are of the same type.
Parameters
- $first mixed
- $second mixed
shouldBeNumeric ( $attribute , $rule ) : void
Adds the existing rule to the numericRules array if the attribute's value is numeric.
Parameters
- $attribute string
- $rule string