File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -2058,6 +2058,7 @@ The following rules can be used alongside the
20582058`default validation rules <https://docs.aplus-framework.com/guides/libraries/validation/index.html#available-rules >`_:
20592059
20602060- `exist `_
2061+ - `existMany `_
20612062- `unique `_
20622063
20632064exist
@@ -2077,6 +2078,40 @@ a dot. If the column is not defined, the field name will be used as the column n
20772078
20782079``$connection `` is the name of the database connection. The default is ``default ``.
20792080
2081+ existMany
2082+ #########
2083+
2084+ Requires that many values exists in the database.
2085+
2086+ .. code-block :: php
2087+
2088+ existMany:$tableColumn
2089+ existMany:$tableColumn,$connection
2090+
2091+ This rule is similar to `exist `_. Except it is able to check if many values are
2092+ present in a database table.
2093+
2094+ It can validate many values from a ``select `` HTML element:
2095+
2096+ .. code-block :: html
2097+
2098+ <select name =" fruits[]" multiple >
2099+ <option value =" 1" >Apple</option >
2100+ <option value =" 2" >Orange</option >
2101+ <option value =" 3" >Pear</option >
2102+ <option value =" 5" >Banana</option >
2103+ <option value =" 9" >Strawberry</option >
2104+ </select >
2105+
2106+ The following example will validate if the ids sent in the ``fruits `` field are
2107+ present in the ``Fruits `` table:
2108+
2109+ .. code-block ::
2110+
2111+ existMany:Fruits.id
2112+
2113+ If any value does not exist, validation will fail.
2114+
20802115unique
20812116######
20822117
You can’t perform that action at this time.
0 commit comments