ValidatesAttributes
trait ValidatesAttributes
Methods
Validate that an attribute was "accepted".
Validate that an attribute is an active URL.
"Break" on first validation fail.
Validate the date is before a given date.
Validate the date is before or equal a given date.
Validate the date is after a given date.
Validate the date is equal or after a given date.
Compare a given date against another using an operator.
Get the date format for an attribute if it has one.
Get the date timestamp.
Given two date/time strings, check that one is after the other.
Get a DateTime instance from a string.
Validate that an attribute contains only alphabetic characters.
Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.
Validate that an attribute contains only alpha-numeric characters.
Validate that an attribute is an array.
Validate the size of an attribute is between a set of values.
Validate that an attribute is a boolean.
Validate that an attribute has a matching confirmation.
Validate that an attribute is a valid date.
Validate that an attribute matches a date format.
Validate that an attribute is different from another attribute.
Validate that an attribute has a given number of digits.
Validate that an attribute is between a given number of digits.
Validate the dimensions of an image matches the given values.
Test if the given width and height fail any conditions.
Determine if the given parameters fail a dimension ratio check.
Validate an attribute is unique among other values.
Validate that an attribute is a valid e-mail address.
Validate the existence of an attribute value in a database table.
Get the number of records that exist in storage.
Validate the uniqueness of an attribute value on a given database table.
Get the excluded ID column and value for the unique rule.
Prepare the given ID for querying.
Get the extra conditions for a unique rule.
Parse the connection / table for the unique / exists rules.
Get the column name for an exists / unique query.
Guess the database column from the given attribute name.
Get the extra conditions for a unique / exists rule.
Validate the given value is a valid file.
Validate the given attribute is filled if it is present.
Validate the MIME type of a file is an image MIME type.
Validate an attribute is contained within a list of values.
Validate that the values of an attribute is in another attribute.
Validate that an attribute is an integer.
Validate that an attribute is a valid IP.
Validate that an attribute is a valid IPv4.
Validate that an attribute is a valid IPv6.
Validate the attribute is a valid JSON string.
Validate the size of an attribute is less than a maximum value.
Validate the guessed extension of a file upload is in a set of file extensions.
Validate the MIME type of a file upload attribute is in a set of MIME types.
Check if PHP uploads are explicitly allowed.
Validate the size of an attribute is greater than a minimum value.
"Indicate" validation should pass if value is null.
Validate an attribute is not contained within a list of values.
Validate that an attribute is numeric.
Validate that an attribute exists even if not filled.
Validate that an attribute passes a regular expression check.
Validate that a required attribute exists.
Validate that an attribute exists when another attribute has a given value.
Convert the given values to boolean if they are string "true" / "false".
Validate that an attribute exists when another attribute does not have a given value.
Validate that an attribute exists when any other attribute exists.
Validate that an attribute exists when all other attributes exists.
Validate that an attribute exists when another attribute does not.
Validate that an attribute exists when all other attributes do not.
Determine if any of the given attributes fail the required test.
Determine if all of the given attributes fail the required test.
Validate that two attributes match.
Validate the size of an attribute.
"Validate" optional attributes.
Validate that an attribute is a string.
Validate that an attribute is a valid timezone.
Validate that an attribute is a valid URL.
Get the size of an attribute.
Check that the given value is a valid file instance.
Determine if a comparison passes between the given values.
Parse named parameters to $key => $value items.
Require a certain number of parameters to be present.
Details
at line 31
protected bool
validateAccepted(string $attribute, mixed $value)
Validate that an attribute was "accepted".
This validation rule implies the attribute is "required".
at line 45
protected bool
validateActiveUrl(string $attribute, mixed $value)
Validate that an attribute is an active URL.
at line 69
protected bool
validateBail()
"Break" on first validation fail.
Always returns true, just lets us put "bail" in rules.
at line 82
protected bool
validateBefore(string $attribute, mixed $value, array $parameters)
Validate the date is before a given date.
at line 97
protected bool
validateBeforeOrEqual(string $attribute, mixed $value, array $parameters)
Validate the date is before or equal a given date.
at line 112
protected bool
validateAfter(string $attribute, mixed $value, array $parameters)
Validate the date is after a given date.
at line 127
protected bool
validateAfterOrEqual(string $attribute, mixed $value, array $parameters)
Validate the date is equal or after a given date.
at line 143
protected bool
compareDates(string $attribute, mixed $value, array $parameters, string $operator)
Compare a given date against another using an operator.
at line 168
protected string|null
getDateFormat(string $attribute)
Get the date format for an attribute if it has one.
at line 181
protected int
getDateTimestamp(mixed $value)
Get the date timestamp.
at line 195
protected bool
checkDateTimeOrder(string $format, string $first, string $second, string $operator)
Given two date/time strings, check that one is after the other.
at line 211
protected DateTime|null
getDateTimeWithOptionalFormat(string $format, string $value)
Get a DateTime instance from a string.
at line 231
protected bool
validateAlpha(string $attribute, mixed $value)
Validate that an attribute contains only alphabetic characters.
at line 243
protected bool
validateAlphaDash(string $attribute, mixed $value)
Validate that an attribute contains only alpha-numeric characters, dashes, and underscores.
at line 259
protected bool
validateAlphaNum(string $attribute, mixed $value)
Validate that an attribute contains only alpha-numeric characters.
at line 275
protected bool
validateArray(string $attribute, mixed $value)
Validate that an attribute is an array.
at line 288
protected bool
validateBetween(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute is between a set of values.
at line 304
protected bool
validateBoolean(string $attribute, mixed $value)
Validate that an attribute is a boolean.
at line 318
protected bool
validateConfirmed(string $attribute, mixed $value)
Validate that an attribute has a matching confirmation.
at line 330
protected bool
validateDate(string $attribute, mixed $value)
Validate that an attribute is a valid date.
at line 353
protected bool
validateDateFormat(string $attribute, mixed $value, array $parameters)
Validate that an attribute matches a date format.
at line 376
protected bool
validateDifferent(string $attribute, mixed $value, array $parameters)
Validate that an attribute is different from another attribute.
at line 399
protected bool
validateDigits(string $attribute, mixed $value, array $parameters)
Validate that an attribute has a given number of digits.
at line 415
protected bool
validateDigitsBetween(string $attribute, mixed $value, array $parameters)
Validate that an attribute is between a given number of digits.
at line 433
protected bool
validateDimensions(string $attribute, mixed $value, array $parameters)
Validate the dimensions of an image matches the given values.
at line 461
protected bool
failsBasicDimensionChecks(array $parameters, int $width, int $height)
Test if the given width and height fail any conditions.
at line 479
protected bool
failsRatioCheck(array $parameters, int $width, int $height)
Determine if the given parameters fail a dimension ratio check.
at line 502
protected bool
validateDistinct(string $attribute, mixed $value, array $parameters)
Validate an attribute is unique among other values.
at line 526
protected bool
validateEmail(string $attribute, mixed $value)
Validate that an attribute is a valid e-mail address.
at line 539
protected bool
validateExists(string $attribute, mixed $value, array $parameters)
Validate the existence of an attribute value in a database table.
at line 567
protected int
getExistCount(mixed $connection, string $table, string $column, mixed $value, array $parameters)
Get the number of records that exist in storage.
at line 594
protected bool
validateUnique(string $attribute, mixed $value, array $parameters)
Validate the uniqueness of an attribute value on a given database table.
If a database column is not specified, the attribute will be used.
at line 633
protected array
getUniqueIds(array $parameters)
Get the excluded ID column and value for the unique rule.
at line 646
protected int
prepareUniqueId(mixed $id)
Prepare the given ID for querying.
at line 669
protected array
getUniqueExtra(array $parameters)
Get the extra conditions for a unique rule.
at line 684
protected array
parseTable(string $table)
Parse the connection / table for the unique / exists rules.
at line 696
protected bool
getQueryColumn(array $parameters, string $attribute)
Get the column name for an exists / unique query.
at line 708
string
guessColumnForQuery(string $attribute)
Guess the database column from the given attribute name.
at line 724
protected array
getExtraConditions(array $segments)
Get the extra conditions for a unique / exists rule.
at line 744
protected bool
validateFile(string $attribute, mixed $value)
Validate the given value is a valid file.
at line 756
protected bool
validateFilled(string $attribute, mixed $value)
Validate the given attribute is filled if it is present.
at line 772
protected bool
validateImage(string $attribute, mixed $value)
Validate the MIME type of a file is an image MIME type.
at line 785
protected bool
validateIn(string $attribute, mixed $value, array $parameters)
Validate an attribute is contained within a list of values.
at line 808
protected bool
validateInArray(string $attribute, mixed $value, array $parameters)
Validate that the values of an attribute is in another attribute.
at line 830
protected bool
validateInteger(string $attribute, mixed $value)
Validate that an attribute is an integer.
at line 842
protected bool
validateIp(string $attribute, mixed $value)
Validate that an attribute is a valid IP.
at line 854
protected bool
validateIpv4(string $attribute, mixed $value)
Validate that an attribute is a valid IPv4.
at line 866
protected bool
validateIpv6(string $attribute, mixed $value)
Validate that an attribute is a valid IPv6.
at line 878
protected bool
validateJson(string $attribute, mixed $value)
Validate the attribute is a valid JSON string.
at line 897
protected bool
validateMax(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute is less than a maximum value.
at line 916
protected bool
validateMimes(string $attribute, mixed $value, array $parameters)
Validate the guessed extension of a file upload is in a set of file extensions.
at line 937
protected bool
validateMimetypes(string $attribute, mixed $value, array $parameters)
Validate the MIME type of a file upload attribute is in a set of MIME types.
at line 959
protected bool
shouldBlockPhpUpload(mixed $value, array $parameters)
Check if PHP uploads are explicitly allowed.
at line 978
protected bool
validateMin(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute is greater than a minimum value.
at line 992
protected bool
validateNullable()
"Indicate" validation should pass if value is null.
Always returns true, just lets us put "nullable" in rules.
at line 1005
protected bool
validateNotIn(string $attribute, mixed $value, array $parameters)
Validate an attribute is not contained within a list of values.
at line 1017
protected bool
validateNumeric(string $attribute, mixed $value)
Validate that an attribute is numeric.
at line 1029
protected bool
validatePresent(string $attribute, mixed $value)
Validate that an attribute exists even if not filled.
at line 1042
protected bool
validateRegex(string $attribute, mixed $value, array $parameters)
Validate that an attribute passes a regular expression check.
at line 1060
protected bool
validateRequired(string $attribute, mixed $value)
Validate that a required attribute exists.
at line 1083
protected bool
validateRequiredIf(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when another attribute has a given value.
at line 1108
protected array
convertValuesToBoolean(array $values)
Convert the given values to boolean if they are string "true" / "false".
at line 1129
protected bool
validateRequiredUnless(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when another attribute does not have a given value.
at line 1152
protected bool
validateRequiredWith(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when any other attribute exists.
at line 1169
protected bool
validateRequiredWithAll(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when all other attributes exists.
at line 1186
protected bool
validateRequiredWithout(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when another attribute does not.
at line 1203
protected bool
validateRequiredWithoutAll(string $attribute, mixed $value, mixed $parameters)
Validate that an attribute exists when all other attributes do not.
at line 1218
protected bool
anyFailingRequired(array $attributes)
Determine if any of the given attributes fail the required test.
at line 1235
protected bool
allFailingRequired(array $attributes)
Determine if all of the given attributes fail the required test.
at line 1254
protected bool
validateSame(string $attribute, mixed $value, array $parameters)
Validate that two attributes match.
at line 1271
protected bool
validateSize(string $attribute, mixed $value, array $parameters)
Validate the size of an attribute.
at line 1285
protected bool
validateSometimes()
"Validate" optional attributes.
Always returns true, just lets us put sometimes in rules.
at line 1297
protected bool
validateString(string $attribute, mixed $value)
Validate that an attribute is a string.
at line 1309
protected bool
validateTimezone(string $attribute, mixed $value)
Validate that an attribute is a valid timezone.
at line 1329
protected bool
validateUrl(string $attribute, mixed $value)
Validate that an attribute is a valid URL.
at line 1366
protected mixed
getSize(string $attribute, mixed $value)
Get the size of an attribute.
at line 1391
bool
isValidFileInstance(mixed $value)
Check that the given value is a valid file instance.
at line 1408
protected bool
compare(mixed $first, mixed $second, string $operator)
Determine if a comparison passes between the given values.
at line 1430
protected array
parseNamedParameters(array $parameters)
Parse named parameters to $key => $value items.
at line 1451
protected void
requireParameterCount(int $count, array $parameters, string $rule)
Require a certain number of parameters to be present.