12-10-2022, 11:42 AM (This post was last modified: 12-10-2022, 11:43 AM by bassmandc.)
I'm using "required_with" validation on a project with multiple fields. As per documentation, it's implemented like this:
required_with[field1,field2]
Is it possible to have a different error message when field1 fails versus when field2 fails? If so, how is that formatted? I'm looking for something like this:
'example' => [ 'rules' => 'required_with[field1,field2]', 'errors' => [ 'required_with.field1' => 'Error message related to field 1', 'required_with.field2' => 'Error message related to field 2', ], ],
... but obviously this does not work. Any guidance appreciated!