diff --git a/validation.md b/validation.md index ef18ae4388..11ff1849f5 100644 --- a/validation.md +++ b/validation.md @@ -940,7 +940,25 @@ After defining this value, the validation rule will produce the following error ```text The credit card number field is required when payment type is credit card. ``` +### nullable +The `nullable` rule allows a field to be `null`. If the field is `null`, no other validation rules will be applied to it. + +```php +$request->validate([ + 'middle_name' => ['nullable', 'string', 'max:50'], +]); +``` +### prohibited_if + +The `prohibited_if` rule prohibits a field from being present if another specified field has a certain value. This is useful for creating dynamic forms where some fields should be excluded based on the values of others. + +```php +$request->validate([ + 'company_name' => 'prohibited_if:is_freelancer,true', + 'is_freelancer' => 'boolean', +]); +``` ## Available Validation Rules