Laravel validation One of Two Fields
Laravel provides validation to your application’s incoming data. Laravel’s by default controller base class uses ValidatesRequests. method to validate incoming HTTP requests with a variety of powerful validation rules.
How to Laravel One of Two Fields validation adds. Here to learn about Laravel built-in rules: required_without and required_without_all and complete example of validating.
required_without => The field under validation must be present only when any of the other specified fields are not present.
required_without:field1,field2,...
required_without_all => The field under validation must be present only when all of other specified fields are not present.
required_without_all:field1,field2,...
Example :
$rules = array( 'field1' => 'required_without:field2,field3', 'field2' => 'required_without_all:field1,field3', ); $validator = Validator::make(Input::all(), $rules);