Tuesday, May 23, 2017

How to combine another Laravel validation rule with 'required_without_all'

I am working with Laravel 5.3.

I am trying to implement the 'required_without_all' validation rule. I have it working as expected, however I want to add an additional rule (ie a minimum value rule). But I want this additional validation rule to run only if there is a value present in the field.

So to summarise, I have several fields and want the following validation:

  • At least one field out of them should be filled in (achieved this using the 'required_without_rule').
  • For fields that are filled in, I want a minimum value rule.

How can I achieve this?



via Sid

Advertisement