Oihana PHP

requiredIf.php

Table of Contents

Functions

requiredIf()  : string
Generates the 'required_if:anotherField,value1,value2,...' rule expression.

Functions

requiredIf()

Generates the 'required_if:anotherField,value1,value2,...' rule expression.

requiredIf(string $anotherField, mixed ...$values) : string

The field under this rule must be present and not empty if the another_field field is equal to any value.

For example required_if:something,1,yes,on will be required if something's value is one of 1, '1', 'yes', or 'on'.

Parameters
$anotherField : string

The another field to evaluates.

$values : mixed

The values of $anotherField that make this field required.

Return values
string

The compiled required_if:<field>,<values> rule expression.

On this page

Search results