requires.php
Table of Contents
Functions
- requires() : string
- Generates the 'requires:field1,field2,...' rule expression.
Functions
requires()
Generates the 'requires:field1,field2,...' rule expression.
requires(string ...$fields) : string
The field under validation requires that the specified fields are present in the input data and are not empty.
For example: field b "requires:a"; if a is either not present, or has an "empty" value, then the validation fails. "empty" is false, empty string, or null.
This is an extension of required_with, however the rule will fail when used with sometimes or nullable. For example: if b "requires:a" and "a" is allowed to be nullable, b will fail as it explicitly requires a with a value.
Parameters
- $fields : string