Skip to content

Commit 1e6a0dc

Browse files
authored
Merge pull request #1862 from atishamte/required_without
required_with and required_without definition changes
2 parents b2deed2 + f281a25 commit 1e6a0dc

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

system/Validation/Rules.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public function required($str = null): bool
279279
//--------------------------------------------------------------------
280280

281281
/**
282-
* The field is required when any of the other fields are present
282+
* The field is required when any of the other required fields are present
283283
* in the data.
284284
*
285285
* Example (field is required when the password field is present):
@@ -331,8 +331,8 @@ public function required_with($str = null, string $fields, array $data): bool
331331
//--------------------------------------------------------------------
332332

333333
/**
334-
* The field is required when all of the other fields are not present
335-
* in the data.
334+
* The field is required when all of the other fields are present
335+
* in the data but not required.
336336
*
337337
* Example (field is required when the id or email field is missing):
338338
*

user_guide_src/source/libraries/validation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,8 @@ if_exist No If this rule is present, validation will onl
679679
regardless of its value.
680680
permit_empty No Allows the field to receive an empty array, empty string, null or false.
681681
required No Fails if the field is an empty array, empty string, null or false.
682-
required_with Yes The field is required if any of the fields in the parameter are set. required_with[field1,field2]
683-
required_without Yes The field is required when any of the fields in the parameter are not set. required_without[field1,field2]
682+
required_with Yes The field is required when any of the other required fields are present in the data. required_with[field1,field2]
683+
required_without Yes The field is required when all of the other fields are present in the data but not required. required_without[field1,field2]
684684
is_unique Yes Checks if this field value exists in the database. Optionally set a is_unique[table.field,ignore_field,ignore_value]
685685
column and value to ignore, useful when updating records to ignore itself.
686686
timezone No Fails if field does match a timezone per ``timezone_identifiers_list``

0 commit comments

Comments
 (0)