laravel validation rules for multiple value


I am trying to validate form data using laravel validation. I want to validate some fields based on some conditions.

Suppose I have three input fields – input1, input2, input3

input3 is required or not it depends on input1 and input2.

  1. if the input1 value is 1, input3 is not required.
    N.B. what input2 is that doesn’t matter.

  2. if the input2 value is 2, input3 is not required.
    N.B. what input1 is that doesn’t matter.

Except for the above two cases, Input3 is required.

How can I do that?

Source: Laravel

Leave a Reply