title: Laravel validations with "or" condition
body: <p>I'm trying to make an input validation in Laravel with a somewhat complex "or" condition.</p>
  
  <p>I need the validator to validate the input (let it pass) if its value is present in a specific table or if its value is "other".</p>
  
  <p>So far, I have:</p>
  
  <pre><code>$validator = Validator::make($data, [
  
      ...
  
      'doc_organization' =&gt; ['required_with:rb_regist,doctor, exists:user_organizations,full_name'], // TODO: must exist in user_organizations table or be "other"
      'doc_custom_organization' =&gt; ['required_if:doc_organization,other', 'max:160'],
  
      ...
  </code></pre>
  
  <p>I took a look at Laravel's custom validation rules, conditionally adding rules, and so forth, as well as these posts:</p>
  
  <p><a href="https://stackoverflow.com/questions/50644122/laravel-validation-with-or">Laravel Validation with or</a></p>
  
  <p><a href="https://stackoverflow.com/questions/42320292/validation-rules-required-if-with-other-condition-laravel-54">Validation rules required_if with other condition (Laravel 5.4)</a></p>
  
  <p>But I can't seem to come up with a custom rule in which I don't query the whole table to know if the name exists (in case it is not "other"). That would make the rule too complex for its purpose.</p>
  
  <p>The other solution I have is to add an entry named "other" in the user_organizations table, which is not ideal.</p>
  
  <p>Am I missing something?
  How can I make the condition I want without a complex custom validation rule?</p>
  
  <p>Thank you very much.</p>