@@ -743,7 +743,7 @@ Configuration
743
743
=============
744
744
745
745
Once you have your views created, you need to let the Validation library know about them. Open **app/Config/Validation.php **.
746
- Inside, you'll find the ``$templates `` property where you can list as many custom views as you want, and provide an
746
+ Inside, you'll find the ``$templates `` property where you can list as many custom views as you want, and provide a
747
747
short alias they can be referenced by. If we were to add our example file from above, it would look something like:
748
748
749
749
.. literalinclude :: validation/032.php
@@ -769,7 +769,7 @@ Creating Custom Rules
769
769
Using Rule Classes
770
770
==================
771
771
772
- Rules are stored within simple, namespaced classes. They can be stored any location you would like, as long as the
772
+ Rules are stored within simple, namespaced classes. They can be stored in any location you would like, as long as the
773
773
autoloader can find it. These files are called RuleSets.
774
774
775
775
Adding a RuleSet
@@ -781,7 +781,7 @@ add the new file to the ``$ruleSets`` array:
781
781
.. literalinclude :: validation/033.php
782
782
783
783
You can add it as either a simple string with the fully qualified class name, or using the ``::class `` suffix as
784
- shown above. The primary benefit here is that it provides some extra navigation capabilities in more advanced IDEs.
784
+ shown above. The primary benefit of using the `` ::class `` suffix is that it provides some extra navigation capabilities in more advanced IDEs.
785
785
786
786
Creating a Rule Class
787
787
---------------------
@@ -921,8 +921,9 @@ decimal No Fails if field contains anything other than
921
921
``- `` sign for the number.
922
922
differs Yes Fails if field does not differ from the one ``differs[field_name] ``
923
923
in the parameter.
924
- exact_length Yes Fails if field is not exactly the parameter ``exact_length[5] `` or ``exact_length[5,8,12] ``
925
- value. One or more comma-separated values.
924
+ exact_length Yes Fails if field length is not exactly ``exact_length[5] `` or ``exact_length[5,8,12] ``
925
+ the parameter value. One or more
926
+ comma-separated values are possible.
926
927
field_exists Yes Fails if field does not exist. (This rule was
927
928
added in v4.5.0.)
928
929
greater_than Yes Fails if field is less than or equal to ``greater_than[8] ``
@@ -943,7 +944,7 @@ is_natural No Fails if field contains anything other than
943
944
is_natural_no_zero No Fails if field contains anything other than
944
945
a natural number, except zero: 1, 2, 3, etc.
945
946
is_not_unique Yes Checks the database to see if the given value ``is_not_unique[table.field,where_field,where_value] ``
946
- exist . Can ignore records by field/value to
947
+ exists . Can ignore records by field/value to
947
948
filter (currently accept only one filter).
948
949
is_unique Yes Checks if this field value exists in the ``is_unique[table.field,ignore_field,ignore_value] ``
949
950
database. Optionally set a column and value
@@ -975,8 +976,8 @@ required_without Yes The field is required when any of the other
975
976
fields is `empty() `_ in the data.
976
977
string No A generic alternative to the alpha* rules
977
978
that confirms the element is a string
978
- timezone No Fails if field does match a timezone per
979
- `timezone_identifiers_list() `_
979
+ timezone No Fails if field does not match a timezone
980
+ per `timezone_identifiers_list() `_
980
981
valid_base64 No Fails if field contains anything other than
981
982
valid Base64 characters.
982
983
valid_json No Fails if field does not contain a valid JSON
@@ -1001,7 +1002,7 @@ valid_url_strict Yes Fails if field does not contain a valid URL.
1001
1002
valid_date Yes Fails if field does not contain a valid date. ``valid_date[d/m/Y] ``
1002
1003
Any string that `strtotime() `_ accepts is
1003
1004
valid if you don't specify an optional
1004
- parameter to matches a date format.
1005
+ parameter that matches a date format.
1005
1006
**So it is usually necessary to specify
1006
1007
the parameter. **
1007
1008
valid_cc_number Yes Verifies that the credit card number matches ``valid_cc_number[amex] ``
@@ -1069,9 +1070,9 @@ uploaded Yes Fails if the name of the parameter does not
1069
1070
If you want the file upload to be optional
1070
1071
(not required), do not define this rule.
1071
1072
1072
- max_size Yes Fails if the uploaded file named in the ``max_size[field_name,2048]``
1073
- parameter is larger than the second
1074
- parameter in kilobytes (kb). Or if the file
1073
+ max_size Yes Fails if the uploaded file is larger ``max_size[field_name,2048]``
1074
+ than the second parameter
1075
+ in kilobytes (kb). Or if the file
1075
1076
is larger than allowed maximum size declared
1076
1077
in php.ini config file -
1077
1078
``upload_max_filesize `` directive.
0 commit comments